summaryrefslogtreecommitdiff
path: root/includes/objectcache/RedisBagOStuff.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-12-08 09:55:49 +0100
commit4ac9fa081a7c045f6a9f1cfc529d82423f485b2e (patch)
treeaf68743f2f4a47d13f2b0eb05f5c4aaf86d8ea37 /includes/objectcache/RedisBagOStuff.php
parentaf4da56f1ad4d3ef7b06557bae365da2ea27a897 (diff)
Update to MediaWiki 1.22.0
Diffstat (limited to 'includes/objectcache/RedisBagOStuff.php')
-rw-r--r--includes/objectcache/RedisBagOStuff.php40
1 files changed, 7 insertions, 33 deletions
diff --git a/includes/objectcache/RedisBagOStuff.php b/includes/objectcache/RedisBagOStuff.php
index f9feaf9d..135e0e83 100644
--- a/includes/objectcache/RedisBagOStuff.php
+++ b/includes/objectcache/RedisBagOStuff.php
@@ -140,7 +140,13 @@ class RedisBagOStuff extends BagOStuff {
$conn->setex( $key, $expiry, $value );
}
- $result = $conn->exec();
+ /*
+ * multi()/exec() (transactional mode) allows multiple values to
+ * be set/get at once and will return an array of results, in
+ * the order they were set/get. In this case, we only set 1
+ * value, which should (in case of success) result in true.
+ */
+ $result = ( $conn->exec() == array( true ) );
} catch ( RedisException $e ) {
$result = false;
$this->handleException( $server, $conn, $e );
@@ -268,38 +274,6 @@ class RedisBagOStuff extends BagOStuff {
}
/**
- * Non-atomic implementation of incr().
- *
- * Probably all callers actually want incr() to atomically initialise
- * values to zero if they don't exist, as provided by the Redis INCR
- * command. But we are constrained by the memcached-like interface to
- * return null in that case. Once the key exists, further increments are
- * atomic.
- */
- public function incr( $key, $value = 1 ) {
- wfProfileIn( __METHOD__ );
- list( $server, $conn ) = $this->getConnection( $key );
- if ( !$conn ) {
- wfProfileOut( __METHOD__ );
- return false;
- }
- if ( !$conn->exists( $key ) ) {
- wfProfileOut( __METHOD__ );
- return null;
- }
- try {
- $result = $conn->incrBy( $key, $value );
- } catch ( RedisException $e ) {
- $result = false;
- $this->handleException( $server, $conn, $e );
- }
-
- $this->logRequest( 'incr', $key, $server, $result );
- wfProfileOut( __METHOD__ );
- return $result;
- }
-
- /**
* Get a Redis object with a connection suitable for fetching the specified key
* @return Array (server, RedisConnRef) or (false, false)
*/