diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:32:59 -0400 |
commit | 6dc1997577fab2c366781fd7048144935afa0012 (patch) | |
tree | 8918d28c7ab4342f0738985e37af1dfc42d0e93a /includes/libs/ProcessCacheLRU.php | |
parent | 150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff) | |
parent | fa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff) |
Merge commit 'fa89acd'
# Conflicts:
# .gitignore
# extensions/ArchInterWiki.sql
Diffstat (limited to 'includes/libs/ProcessCacheLRU.php')
-rw-r--r-- | includes/libs/ProcessCacheLRU.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/includes/libs/ProcessCacheLRU.php b/includes/libs/ProcessCacheLRU.php index 8d80eb38..b55ff9da 100644 --- a/includes/libs/ProcessCacheLRU.php +++ b/includes/libs/ProcessCacheLRU.php @@ -20,6 +20,7 @@ * @file * @ingroup Cache */ +use Wikimedia\Assert\Assert; /** * Handles per process caching of items @@ -128,9 +129,9 @@ class ProcessCacheLRU { * @throws UnexpectedValueException */ public function resize( $maxKeys ) { - if ( !is_int( $maxKeys ) || $maxKeys < 1 ) { - throw new UnexpectedValueException( __METHOD__ . " must be given an integer >= 1" ); - } + Assert::parameterType( 'integer', $maxKeys, '$maxKeys' ); + Assert::parameter( $maxKeys >= 1, '$maxKeys', 'must be >= 1' ); + $this->maxCacheKeys = $maxKeys; while ( count( $this->cache ) > $this->maxCacheKeys ) { reset( $this->cache ); |