if ( !isset( $params['writeFactory'] ) ) {
throw new InvalidArgumentException(
__METHOD__ . ': the "writeFactory" parameter is required' );
- } elseif ( !isset( $params['readFactory'] ) ) {
+ }
+ if ( !isset( $params['readFactory'] ) ) {
throw new InvalidArgumentException(
__METHOD__ . ': the "readFactory" parameter is required' );
}
$this->readStore->setDebug( $debug );
}
- public function get( $key, &$casToken = null ) {
- return $this->readStore->get( $key, $casToken );
+ public function get( $key, &$casToken = null, $flags = 0 ) {
+ return ( $flags & self::READ_LATEST )
+ ? $this->writeStore->get( $key, $casToken, $flags )
+ : $this->readStore->get( $key, $casToken, $flags );
}
- public function getMulti( $keys ) {
- return $this->readStore->getMulti( $keys );
+ public function getMulti( array $keys, $flags = 0 ) {
+ return ( $flags & self::READ_LATEST )
+ ? $this->writeStore->getMulti( $keys, $flags )
+ : $this->readStore->getMulti( $keys, $flags );
}
public function set( $key, $value, $exptime = 0 ) {
return $this->writeStore->incr( $key, $value );
}
- public function decr( $key ) {
- return $this->writeStore->decr( $key );
+ public function decr( $key, $value = 1 ) {
+ return $this->writeStore->decr( $key, $value );
}
- public function lock( $key, $timeout = 6, $expiry = 6 ) {
- return $this->writeStore->lock( $key, $timeout, $expiry );
+ public function lock( $key, $timeout = 6, $expiry = 6, $rclass = '' ) {
+ return $this->writeStore->lock( $key, $timeout, $expiry, $rclass );
}
public function unlock( $key ) {