X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FRedisBagOStuff.php;h=2c74d4591626d272a419a0534e55b3dc1930e8de;hp=f64fe7e780da484f4b7e184c0c1d2a09bff229ab;hb=a38af7ba26579bb3004f673e44d39710887763aa;hpb=b8e0ca16aa743581f5fac5cef8bed5ac2bf6e7cb diff --git a/includes/libs/objectcache/RedisBagOStuff.php b/includes/libs/objectcache/RedisBagOStuff.php index f64fe7e780..2c74d45916 100644 --- a/includes/libs/objectcache/RedisBagOStuff.php +++ b/includes/libs/objectcache/RedisBagOStuff.php @@ -86,13 +86,9 @@ class RedisBagOStuff extends BagOStuff { $this->attrMap[self::ATTR_SYNCWRITES] = self::QOS_SYNCWRITES_NONE; } - protected function doGet( $key, $flags = 0 ) { + protected function doGet( $key, $flags = 0, &$casToken = null ) { $casToken = null; - return $this->getWithToken( $key, $casToken, $flags ); - } - - protected function getWithToken( $key, &$casToken, $flags = 0 ) { list( $server, $conn ) = $this->getConnection( $key ); if ( !$conn ) { return false; @@ -297,10 +293,6 @@ class RedisBagOStuff extends BagOStuff { return $result; } - public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) { - return $this->mergeViaCas( $key, $callback, $exptime, $attempts ); - } - /** * Non-atomic implementation of incr(). * @@ -333,21 +325,29 @@ class RedisBagOStuff extends BagOStuff { return $result; } - public function changeTTL( $key, $expiry = 0, $flags = 0 ) { + public function changeTTL( $key, $exptime = 0, $flags = 0 ) { list( $server, $conn ) = $this->getConnection( $key ); if ( !$conn ) { return false; } - $expiry = $this->convertToRelative( $expiry ); + $relative = $this->expiryIsRelative( $exptime ); try { - $result = $conn->expire( $key, $expiry ); + if ( $exptime == 0 ) { + $result = $conn->persist( $key ); + $this->logRequest( 'persist', $key, $server, $result ); + } elseif ( $relative ) { + $result = $conn->expire( $key, $this->convertToRelative( $exptime ) ); + $this->logRequest( 'expire', $key, $server, $result ); + } else { + $result = $conn->expireAt( $key, $this->convertToExpiry( $exptime ) ); + $this->logRequest( 'expireAt', $key, $server, $result ); + } } catch ( RedisException $e ) { $result = false; $this->handleException( $conn, $e ); } - $this->logRequest( 'expire', $key, $server, $result ); return $result; }