*/
class ProcessCacheLRU {
/** @var Array */
- protected $cache = array(); // (key => prop => value)
+ protected $cache = []; // (key => prop => value)
/** @var Array */
- protected $cacheTimes = array(); // (key => prop => UNIX timestamp)
+ protected $cacheTimes = []; // (key => prop => UNIX timestamp)
protected $maxCacheKeys; // integer; max entries
*/
public function clear( $keys = null ) {
if ( $keys === null ) {
- $this->cache = array();
- $this->cacheTimes = array();
+ $this->cache = [];
+ $this->cacheTimes = [];
} else {
foreach ( (array)$keys as $key ) {
unset( $this->cache[$key] );
unset( $this->cache[$key] );
$this->cache[$key] = $item;
}
+
+ /**
+ * Get cache size
+ * @return int
+ */
+ public function getSize() {
+ return $this->maxCacheKeys;
+ }
}