cache = new MapCacheLRU( $maxKeys ); } /** * Set a property field for a cache entry. * This will prune the cache if it gets too large based on LRU. * If the item is already set, it will be pushed to the top of the cache. * * @param string $key * @param string $prop * @param mixed $value * @return void */ public function set( $key, $prop, $value ) { $this->cache->setField( $key, $prop, $value ); } /** * Check if a property field exists for a cache entry. * * @param string $key * @param string $prop * @param float $maxAge Ignore items older than this many seconds (since 1.21) * @return bool */ public function has( $key, $prop, $maxAge = 0.0 ) { return $this->cache->hasField( $key, $prop, $maxAge ); } /** * Get a property field for a cache entry. * This returns null if the property is not set. * If the item is already set, it will be pushed to the top of the cache. * * @param string $key * @param string $prop * @return mixed */ public function get( $key, $prop ) { return $this->cache->getField( $key, $prop ); } /** * Clear one or several cache entries, or all cache entries. * * @param string|array|null $keys * @return void */ public function clear( $keys = null ) { $this->cache->clear( $keys ); } /** * Resize the maximum number of cache entries, removing older entries as needed * * @param int $maxKeys * @return void * @throws UnexpectedValueException */ public function resize( $maxKeys ) { $this->cache->setMaxSize( $maxKeys ); } /** * Get cache size * @return int */ public function getSize() { return $this->cache->getMaxSize(); } }