45 unset(
$params[
'reportDupes'] );
49 $this->backend = $backend;
50 $this->attrMap = $backend->attrMap;
53 protected function doGet( $key, $flags = 0 ) {
54 $ret = parent::doGet( $key, $flags );
55 if (
$ret ===
false && !$this->
hasKey( $key ) ) {
56 $ret = $this->backend->doGet( $key, $flags );
57 $this->
set( $key,
$ret, 0, self::WRITE_CACHE_ONLY );
62 public function set( $key,
$value, $exptime = 0, $flags = 0 ) {
63 parent::set( $key,
$value, $exptime, $flags );
64 if ( !( $flags & self::WRITE_CACHE_ONLY ) ) {
65 $this->backend->set( $key,
$value, $exptime, $flags & ~self::WRITE_CACHE_ONLY );
70 public function delete( $key, $flags = 0 ) {
71 unset( $this->bag[$key] );
72 if ( !( $flags & self::WRITE_CACHE_ONLY ) ) {
73 $this->backend->delete( $key );
80 parent::setDebug( $bool );
81 $this->backend->setDebug( $bool );
85 parent::deleteObjectsExpiringBefore( $date, $progressCallback );
86 return $this->backend->deleteObjectsExpiringBefore( $date, $progressCallback );
89 public function makeKey( $class, $component =
null ) {
90 return call_user_func_array( [ $this->backend, __FUNCTION__ ], func_get_args() );
94 return call_user_func_array( [ $this->backend, __FUNCTION__ ], func_get_args() );
100 public function lock( $key, $timeout = 6, $expiry = 6, $rclass =
'' ) {
101 return $this->backend->lock( $key, $timeout, $expiry, $rclass );
105 return $this->backend->unlock( $key );
109 return $this->backend->getLastError();
113 return $this->backend->clearLastError();
117 return $this->backend->modifySimpleRelayEvent( $event );
interface is intended to be more or less compatible with the PHP memcached client.
Wrapper around a BagOStuff that caches data in memory.
__construct(BagOStuff $backend, $params=[])
getLastError()
Get the "last error" registered; clearLastError() should be called manually.
unlock( $key)
Release an advisory lock on a key string.
lock( $key, $timeout=6, $expiry=6, $rclass='')
Acquire an advisory lock on a key string.
modifySimpleRelayEvent(array $event)
Modify a cache update operation array for EventRelayer::notify()
clearLastError()
Clear the "last error" registry.
makeGlobalKey( $class, $component=null)
Make a global cache key.
makeKey( $class, $component=null)
Make a cache key, scoped to this instance's keyspace.
deleteObjectsExpiringBefore( $date, $progressCallback=false)
Delete all objects expiring before a certain date.
Simple store for keeping values in an associative array for the current process.
hasKey( $key)
Does this bag have a non-null value for the given key?
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses & $ret