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 "Add Special:Mute as a shortcut for muting notifications"
[lhc/web/wiklou.git]
/
includes
/
libs
/
objectcache
/
HashBagOStuff.php
diff --git
a/includes/libs/objectcache/HashBagOStuff.php
b/includes/libs/objectcache/HashBagOStuff.php
index
d24f408
..
016bdfe
100644
(file)
--- a/
includes/libs/objectcache/HashBagOStuff.php
+++ b/
includes/libs/objectcache/HashBagOStuff.php
@@
-49,6
+49,7
@@
class HashBagOStuff extends BagOStuff {
* - maxKeys : only allow this many keys (using oldest-first eviction)
*/
function __construct( $params = [] ) {
* - maxKeys : only allow this many keys (using oldest-first eviction)
*/
function __construct( $params = [] ) {
+ $params['segmentationSize'] = $params['segmentationSize'] ?? INF;
parent::__construct( $params );
$this->token = microtime( true ) . ':' . mt_rand();
parent::__construct( $params );
$this->token = microtime( true ) . ':' . mt_rand();
@@
-75,7
+76,7
@@
class HashBagOStuff extends BagOStuff {
return $this->bag[$key][self::KEY_VAL];
}
return $this->bag[$key][self::KEY_VAL];
}
- p
ublic function s
et( $key, $value, $exptime = 0, $flags = 0 ) {
+ p
rotected function doS
et( $key, $value, $exptime = 0, $flags = 0 ) {
// Refresh key position for maxCacheKeys eviction
unset( $this->bag[$key] );
$this->bag[$key] = [
// Refresh key position for maxCacheKeys eviction
unset( $this->bag[$key] );
$this->bag[$key] = [
@@
-94,14
+95,14
@@
class HashBagOStuff extends BagOStuff {
}
public function add( $key, $value, $exptime = 0, $flags = 0 ) {
}
public function add( $key, $value, $exptime = 0, $flags = 0 ) {
- if ( $this->
get( $key ) === false
) {
- return
$this->set( $key, $value, $exptime, $flags );
+ if ( $this->
hasKey( $key ) && !$this->expire( $key )
) {
+ return
false; // key already set
}
}
- return
false; // key already set
+ return
$this->doSet( $key, $value, $exptime, $flags );
}
}
- p
ublic function d
elete( $key, $flags = 0 ) {
+ p
rotected function doD
elete( $key, $flags = 0 ) {
unset( $this->bag[$key] );
return true;
unset( $this->bag[$key] );
return true;
@@
-136,7
+137,7
@@
class HashBagOStuff extends BagOStuff {
return false;
}
return false;
}
- $this->delete( $key );
+ $this->d
oD
elete( $key );
return true;
}
return true;
}