* @param $value mixed
* @param $exptime int
* @return bool success
+ * @deprecated 1.23
*/
public function replace( $key, $value, $exptime = 0 ) {
+ wfDeprecated( __METHOD__, '1.23' );
if ( $this->get( $key ) !== false ) {
return $this->set( $key, $value, $exptime );
}
$this->fixExpiry( $exptime ) );
}
- /**
- * @param $key string
- * @param $value int
- * @param $exptime
- * @return Mixed
- */
- public function replace( $key, $value, $exptime = 0 ) {
- return $this->client->replace( $this->encodeKey( $key ), $value,
- $this->fixExpiry( $exptime ) );
- }
-
/**
* Get the underlying client object. This is provided for debugging
* purposes.
return $this->checkResult( $key, parent::add( $key, $value, $exptime ) );
}
- /**
- * @param $key string
- * @param $value int
- * @param $exptime
- * @return Mixed
- */
- public function replace( $key, $value, $exptime = 0 ) {
- $this->debugLog( "replace($key)" );
- return $this->checkResult( $key, parent::replace( $key, $value, $exptime ) );
- }
-
/**
* @param $key string
* @param $value int
return $result;
}
- /**
- * Non-atomic implementation of replace(). Could perhaps be done atomically
- * with WATCH or scripting, but this function is rarely used.
- */
- public function replace( $key, $value, $expiry = 0 ) {
- $section = new ProfileSection( __METHOD__ );
-
- list( $server, $conn ) = $this->getConnection( $key );
- if ( !$conn ) {
- return false;
- }
- if ( !$conn->exists( $key ) ) {
- return false;
- }
-
- $expiry = $this->convertToRelative( $expiry );
- try {
- if ( !$expiry ) {
- $result = $conn->set( $key, $this->serialize( $value ) );
- } else {
- $result = $conn->setex( $key, $expiry, $this->serialize( $value ) );
- }
- } catch ( RedisException $e ) {
- $result = false;
- $this->handleException( $conn, $e );
- }
-
- $this->logRequest( 'replace', $key, $server, $result );
- return $result;
- }
-
/**
* Non-atomic implementation of incr().
*