/**
* Redis-based caching module for redis server >= 2.6.12
*
- * @note: avoid use of Redis::MULTI transactions for twemproxy support
+ * @note Avoid use of Redis::MULTI transactions for twemproxy support
+ *
+ * @ingroup Cache
+ * @ingroup Redis
*/
class RedisBagOStuff extends BagOStuff {
/** @var RedisConnectionPool */
}
protected function doGet( $key, $flags = 0 ) {
+ $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;
}
try {
$value = $conn->get( $key );
+ $casToken = $value;
$result = $this->unserialize( $value );
} catch ( RedisException $e ) {
$result = false;
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().
*
}
try {
if ( !$conn->exists( $key ) ) {
- return null;
+ return false;
}
// @FIXME: on races, the key may have a 0 TTL
$result = $conn->incrBy( $key, $value );
*/
protected function getMasterLinkStatus( RedisConnRef $conn ) {
$info = $conn->info();
- return isset( $info['master_link_status'] )
- ? $info['master_link_status']
- : null;
+ return $info['master_link_status'] ?? null;
}
/**