dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Added a separate error message for mkdir failures"
[lhc/web/wiklou.git]
/
includes
/
libs
/
objectcache
/
HashBagOStuff.php
diff --git
a/includes/libs/objectcache/HashBagOStuff.php
b/includes/libs/objectcache/HashBagOStuff.php
index
6e7fb0c
..
baa3c32
100644
(file)
--- a/
includes/libs/objectcache/HashBagOStuff.php
+++ b/
includes/libs/objectcache/HashBagOStuff.php
@@
-20,7
+20,6
@@
* @file
* @ingroup Cache
*/
* @file
* @ingroup Cache
*/
-use Wikimedia\Assert\Assert;
/**
* Simple store for keeping values in an associative array for the current process.
/**
* Simple store for keeping values in an associative array for the current process.
@@
-46,7
+45,9
@@
class HashBagOStuff extends BagOStuff {
parent::__construct( $params );
$this->maxCacheKeys = isset( $params['maxKeys'] ) ? $params['maxKeys'] : INF;
parent::__construct( $params );
$this->maxCacheKeys = isset( $params['maxKeys'] ) ? $params['maxKeys'] : INF;
- Assert::parameter( $this->maxCacheKeys > 0, 'maxKeys', 'must be above zero' );
+ if ( $this->maxCacheKeys <= 0 ) {
+ throw new InvalidArgumentException( '$maxKeys parameter must be above zero' );
+ }
}
protected function expire( $key ) {
}
protected function expire( $key ) {
@@
-60,8
+61,19
@@
class HashBagOStuff extends BagOStuff {
return true;
}
return true;
}
+ /**
+ * Does this bag have a non-null value for the given key?
+ *
+ * @param string $key
+ * @return bool
+ * @since 1.27
+ */
+ protected function hasKey( $key ) {
+ return isset( $this->bag[$key] );
+ }
+
protected function doGet( $key, $flags = 0 ) {
protected function doGet( $key, $flags = 0 ) {
- if ( !
isset( $this->bag[$key]
) ) {
+ if ( !
$this->hasKey( $key
) ) {
return false;
}
return false;
}