X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FProcessCacheLRU.php;h=03e23edbb753b0f8cc8d506657b9cb41a7b3d22a;hb=7737353a9f92b700bfbd435d997b1872ffdb144d;hp=eec31cee56dc08a65427f1a53f5c59af508618a4;hpb=ff9f2fa33719753ff0c708f9b4a84c57593b9e58;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/ProcessCacheLRU.php b/includes/libs/ProcessCacheLRU.php index eec31cee56..03e23edbb7 100644 --- a/includes/libs/ProcessCacheLRU.php +++ b/includes/libs/ProcessCacheLRU.php @@ -28,10 +28,10 @@ use Wikimedia\Assert\Assert; */ 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 @@ -109,8 +109,8 @@ class ProcessCacheLRU { */ 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] ); @@ -149,4 +149,12 @@ class ProcessCacheLRU { unset( $this->cache[$key] ); $this->cache[$key] = $item; } + + /** + * Get cache size + * @return int + */ + public function getSize() { + return $this->maxCacheKeys; + } }