/** @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 ]
);
}
return $this->caches[0]->unlock( $key );
}
- /**
- * Delete objects expiring before a certain date.
- *
- * Succeed if any of the child caches succeed.
- * @param string $date
- * @param bool|callable $progressCallback
- * @return bool
- */
- public function deleteObjectsExpiringBefore( $date, $progressCallback = false ) {
+ public function deleteObjectsExpiringBefore(
+ $timestamp,
+ callable $progress = null,
+ $limit = INF
+ ) {
$ret = false;
foreach ( $this->caches as $cache ) {
- if ( $cache->deleteObjectsExpiringBefore( $date, $progressCallback ) ) {
+ 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.' );
+ public function addBusyCallback( callable $workCallback ) {
+ $this->caches[0]->addBusyCallback( $workCallback );
}
- 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.' );
- }
-
- 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 );
+ }
}
}