- Assert::parameterType( 'integer', $maxKeys, '$maxKeys' );
- Assert::parameter( $maxKeys > 0, '$maxKeys', 'must be above zero' );
-
- $this->maxCacheKeys = $maxKeys;
- while ( count( $this->cache ) > $this->maxCacheKeys ) {
- reset( $this->cache );
- $evictKey = key( $this->cache );
- unset( $this->cache[$evictKey] );
- unset( $this->cacheTimes[$evictKey] );
- }
- }
-
- /**
- * Push an entry to the top of the cache
- *
- * @param string $key
- */
- protected function ping( $key ) {
- $item = $this->cache[$key];
- unset( $this->cache[$key] );
- $this->cache[$key] = $item;