52 if ( !isset(
$params[
'writeFactory'] ) ) {
53 throw new InvalidArgumentException(
54 __METHOD__ .
': the "writeFactory" parameter is required' );
56 if ( !isset(
$params[
'readFactory'] ) ) {
57 throw new InvalidArgumentException(
58 __METHOD__ .
': the "readFactory" parameter is required' );
61 $opts = [
'reportDupes' =>
false ];
68 $this->attrMap = $this->
mergeFlagMaps( [ $this->readStore, $this->writeStore ] );
72 $this->writeStore->setDebug(
$debug );
73 $this->readStore->setDebug(
$debug );
77 return (
$flags & self::READ_LATEST )
78 ? $this->writeStore->get( $key,
$flags )
79 : $this->readStore->get( $key,
$flags );
83 return (
$flags & self::READ_LATEST )
89 return $this->writeStore->set( $key,
$value, $exptime,
$flags );
92 public function delete( $key ) {
93 return $this->writeStore->delete( $key );
97 return $this->writeStore->add( $key,
$value, $exptime );
101 return $this->writeStore->incr( $key,
$value );
105 return $this->writeStore->decr( $key,
$value );
108 public function lock( $key, $timeout = 6, $expiry = 6, $rclass =
'' ) {
109 return $this->writeStore->lock( $key, $timeout, $expiry, $rclass );
113 return $this->writeStore->unlock( $key );
116 public function merge( $key, callable $callback, $exptime = 0, $attempts = 10,
$flags = 0 ) {
117 return $this->writeStore->merge( $key, $callback, $exptime, $attempts,
$flags );
122 ? $this->writeStore->getLastError()
123 : $this->readStore->getLastError();
127 $this->writeStore->clearLastError();
128 $this->readStore->clearLastError();