$this->serverTagMap[is_int( $key ) ? $server : $key] = $server;
}
- if ( isset( $params['automaticFailover'] ) ) {
- $this->automaticFailover = $params['automaticFailover'];
- } else {
- $this->automaticFailover = true;
- }
+ $this->automaticFailover = $params['automaticFailover'] ?? true;
$this->attrMap[self::ATTR_SYNCWRITES] = self::QOS_SYNCWRITES_NONE;
}
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;
}
/**