diff options
author | Stanislav Malyshev <smalyshev@gmail.com> | 2016-08-17 23:25:37 -0700 |
---|---|---|
committer | Stanislav Malyshev <smalyshev@gmail.com> | 2016-08-18 12:57:34 -0700 |
commit | 5e2376eb94f8d043283e8acc3c74ae93fba1da44 (patch) | |
tree | d008a258ef13bf867fc2e2a08d992ea618666960 /includes/PageProps.php | |
parent | 70ed51d6f652d36672b697ffe94a79a540ca272d (diff) | |
download | mediawikicore-5e2376eb94f8d043283e8acc3c74ae93fba1da44.tar.gz mediawikicore-5e2376eb94f8d043283e8acc3c74ae93fba1da44.zip |
Allow requiring cache size for page props
Needed for batch processing where size of the batch is known
and the batch should fit in cache.
Change-Id: Ib6d6e6ab7e12788c934cd0e973bc35e133aeccbb
Diffstat (limited to 'includes/PageProps.php')
-rw-r--r-- | includes/PageProps.php | 12 |
1 files changed, 11 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 |