58 private $callback =
null;
61 private ?
string $key =
null;
63 private ?
int $lifetime =
null;
65 private array $options = [];
72 $this->cache = $cache;
82 public function key(
string $keygroup, ...$components ) {
83 $this->
key = $this->cache->makeKey( $keygroup, ...$components );
95 public function globalKey(
string $keygroup, ...$components ) {
96 $this->
key = $this->cache->makeGlobalKey( $keygroup, ...$components );
134 return $this->
lifetime( WANObjectCache::TTL_INDEFINITE );
144 return $this->
lifetime( WANObjectCache::TTL_MINUTE );
154 return $this->
lifetime( WANObjectCache::TTL_HOUR );
164 return $this->
lifetime( WANObjectCache::TTL_DAY );
174 return $this->
lifetime( WANObjectCache::TTL_WEEK );
184 return $this->
lifetime( WANObjectCache::TTL_MONTH );
194 return $this->
lifetime( WANObjectCache::TTL_YEAR );
212 $this->options[
'checkKeys'][] = $this->cache->makeKey( $keygroup, ...$components );
226 $this->options[
'checkKeys'][] = $this->cache->makeGlobalKey( $keygroup, ...$components );
243 $this->options[
'touchedCallback'] = $callback;
273 $this->options[
'lockTSE'] = $seconds;
287 $this->options[
'busyValue'] = $value;
305 $this->options[
'lowTTL'] = $seconds;
323 $this->options[
'hotTTR'] = $seconds;
339 $this->options[
'ageNew'] = $seconds;
356 $this->options[
'pcTTL'] = $seconds;
393 $this->options[
'pcGroup'] = $group;
410 $this->options[
'version'] = $version;
422 $this->options[
'segmentable'] = $enabled;
445 if ( $this->
key ===
null ) {
446 throw new LogicException(
'No cache key set; call key(), globalKey(), or rawKey() first' );
449 throw new LogicException(
'No lifetime set; call lifetime(), keepIndefinitely(), or e.g. keepForADay()' );
452 throw new LogicException(
'No callback set; call callback()' );
455 return $this->cache->getWithSetCallback(