}
$val = dba_fetch( $key, $handle );
+ $casToken = $val;
list( $val, $expiry ) = $this->decode( $val );
# Must close ASAP because locks are held
$val = false;
}
- $casToken = $val;
-
wfProfileOut( __METHOD__ );
return $val;
// DBA is locked to any other write connection, so we can safely
// compare the current & previous value before saving new value
$val = dba_fetch( $key, $handle );
- list( $val, $exptime ) = $this->decode( $val );
if ( $casToken !== $val ) {
dba_close( $handle );
wfProfileOut( __METHOD__ );
return false;
}
- $casToken = $this->bag[$key][0];
+ $casToken = serialize( $this->bag[$key][0] );
return $this->bag[$key][0];
}
* @return bool
*/
function cas( $casToken, $key, $value, $exptime = 0 ) {
- if ( $this->get( $key ) === $casToken ) {
+ if ( serialize( $this->get( $key ) ) === $casToken ) {
return $this->set( $key, $value, $exptime );
}
return false;
}
try {
- $result = $this->unserialize( $conn->get( $key ) );
+ $value = $conn->get( $key );
+ $casToken = $value;
+ $result = $this->unserialize( $value );
} catch ( RedisException $e ) {
$result = false;
$this->handleException( $server, $conn, $e );
}
- $casToken = $result;
$this->logRequest( 'get', $key, $server, $result );
return $result;
try {
$conn->watch( $key );
- if ( $this->get( $key ) !== $casToken ) {
+ if ( $this->serialize( $this->get( $key ) ) !== $casToken ) {
$conn->unwatch();
return false;
}