130 $this->cacheKey = $config[
'key'] ??
null;
131 $this->cacheVersion = $config[
'version'] ??
null;
132 $this->regenerator = $config[
'regenerator'] ??
null;
133 $this->lockTSE = $config[
'lockTSE'] ?? 30;
134 $this->checkKeys = $config[
'checkKeys'] ?? [ $this->cacheKey ];
135 $this->touchedCallback = $config[
'touchedCallback'] ??
null;
136 $this->ttl = $config[
'ttl'] ?? WANObjectCache::TTL_DAY;
140 if ( $this->cacheVersion ) {
141 $this->cacheKey = $this->cache->makeKey( self::KEY_PREFIX,
142 strtolower( $this->cacheKey ),
'v' . $this->cacheVersion );
144 $this->cacheKey = $this->cache->makeKey(
145 self::KEY_PREFIX, strtolower( $this->cacheKey )
154 if ( $this->cacheKey ===
null ) {
155 throw new InvalidArgumentException(
"Invalid cache key set. " .
156 "Ensure you have called the configure function before get / setting values." );
159 if ( !is_callable( $this->regenerator ) ) {
160 throw new InvalidArgumentException(
"Invalid regenerator set. " .
161 "Ensure you have called the configure function before get / setting values." );
164 if ( $this->touchedCallback && !is_callable( $this->touchedCallback ) ) {
165 throw new InvalidArgumentException(
"touchedCallback is not callable. " );