/** @var int[] List of all backing cache indexes */
protected $cacheIndexes = [];
- const UPGRADE_TTL = 3600; // TTL when a key is copied to a higher cache tier
+ /** @var int TTL when a key is copied to a higher cache tier */
+ private static $UPGRADE_TTL = 3600;
/**
* $params include:
$this->cacheIndexes = array_keys( $this->caches );
}
- public function setDebug( $debug ) {
+ public function setDebug( $enabled ) {
+ parent::setDebug( $enabled );
foreach ( $this->caches as $cache ) {
- $cache->setDebug( $debug );
+ $cache->setDebug( $enabled );
}
}
$this->asyncWrites,
'set',
// @TODO: consider using self::WRITE_ALLOW_SEGMENTS here?
- [ $key, $value, self::UPGRADE_TTL ]
+ [ $key, $value, self::$UPGRADE_TTL ]
);
}
public function deleteObjectsExpiringBefore(
$timestamp,
- callable $progressCallback = null,
+ callable $progress = null,
$limit = INF
) {
$ret = false;
foreach ( $this->caches as $cache ) {
- if ( $cache->deleteObjectsExpiringBefore( $timestamp, $progressCallback, $limit ) ) {
+ if ( $cache->deleteObjectsExpiringBefore( $timestamp, $progress, $limit ) ) {
$ret = true;
}
}
);
}
+ public function changeTTLMulti( array $keys, $exptime, $flags = 0 ) {
+ return $this->doWrite(
+ $this->cacheIndexes,
+ $this->usesAsyncWritesGivenFlags( $flags ),
+ __FUNCTION__,
+ func_get_args()
+ );
+ }
+
public function incr( $key, $value = 1 ) {
return $this->doWrite(
$this->cacheIndexes,
}
public function makeKeyInternal( $keyspace, $args ) {
- return $this->caches[0]->makeKeyInternal( ...func_get_args() );
+ return $this->caches[0]->makeKeyInternal( $keyspace, $args );
}
- public function makeKey( $class, $component = null ) {
+ public function makeKey( $class, ...$components ) {
return $this->caches[0]->makeKey( ...func_get_args() );
}
- public function makeGlobalKey( $class, $component = null ) {
+ public function makeGlobalKey( $class, ...$components ) {
return $this->caches[0]->makeGlobalKey( ...func_get_args() );
}
- protected function doGet( $key, $flags = 0, &$casToken = null ) {
- throw new LogicException( __METHOD__ . ': proxy class does not need this method.' );
- }
-
- protected function doSet( $key, $value, $exptime = 0, $flags = 0 ) {
- throw new LogicException( __METHOD__ . ': proxy class does not need this method.' );
- }
-
- protected function doDelete( $key, $flags = 0 ) {
- throw new LogicException( __METHOD__ . ': proxy class does not need this method.' );
- }
-
- protected function doGetMulti( array $keys, $flags = 0 ) {
- throw new LogicException( __METHOD__ . ': proxy class does not need this method.' );
+ public function addBusyCallback( callable $workCallback ) {
+ $this->caches[0]->addBusyCallback( $workCallback );
}
- protected function serialize( $value ) {
- throw new LogicException( __METHOD__ . ': proxy class does not need this method.' );
- }
-
- protected function unserialize( $value ) {
- throw new LogicException( __METHOD__ . ': proxy class does not need this method.' );
+ public function setMockTime( &$time ) {
+ parent::setMockTime( $time );
+ foreach ( $this->caches as $cache ) {
+ $cache->setMockTime( $time );
+ $cache->setMockTime( $time );
+ }
}
}