diff options
-rw-r--r-- | includes/PageProps.php | 12 | ||||
-rw-r--r-- | includes/libs/ProcessCacheLRU.php | 8 |
2 files changed, 19 insertions, 1 deletions
diff --git a/includes/PageProps.php b/includes/PageProps.php index 365438472280..5579ba52714b 100644 --- a/includes/PageProps.php +++ b/includes/PageProps.php @@ -85,6 +85,16 @@ class PageProps { } /** + * Ensure that cache has at least this size + * @param int $size + */ + public function ensureCacheSize( $size ) { + if ( $this->cache->getSize() < $size ) { + $this->cache->resize( $size ); + } + } + + /** * Given one or more Titles and one or more names of properties, * returns an associative array mapping page ID to property value. * Pages in the provided set of Titles that do not have a value for @@ -92,7 +102,7 @@ class PageProps { * single Title is provided, it does not need to be passed in an array, * but an array will always be returned. If a single property name is * provided, it does not need to be passed in an array. In that case, - * an associtive array mapping page ID to property value will be + * an associative array mapping page ID to property value will be * returned; otherwise, an associative array mapping page ID to * an associative array mapping property name to property value will be * returned. An empty array will be returned if no matching properties diff --git a/includes/libs/ProcessCacheLRU.php b/includes/libs/ProcessCacheLRU.php index 5a933914c61f..03e23edbb753 100644 --- a/includes/libs/ProcessCacheLRU.php +++ b/includes/libs/ProcessCacheLRU.php @@ -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; + } } |