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 "Selenium: replace UserLoginPage with BlankPage where possible"
[lhc/web/wiklou.git]
/
includes
/
libs
/
objectcache
/
HashBagOStuff.php
diff --git
a/includes/libs/objectcache/HashBagOStuff.php
b/includes/libs/objectcache/HashBagOStuff.php
index
3c6520e
..
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();
@@
-58,12
+59,10
@@
class HashBagOStuff extends BagOStuff {
}
}
}
}
- protected function doGet( $key, $flags = 0 ) {
- if ( !$this->hasKey( $key ) ) {
- return false;
- }
+ protected function doGet( $key, $flags = 0, &$casToken = null ) {
+ $casToken = null;
- if ( $this->expire( $key ) ) {
+ if (
!$this->hasKey( $key ) ||
$this->expire( $key ) ) {
return false;
}
return false;
}
@@
-72,26
+71,17
@@
class HashBagOStuff extends BagOStuff {
unset( $this->bag[$key] );
$this->bag[$key] = $temp;
unset( $this->bag[$key] );
$this->bag[$key] = $temp;
- return $this->bag[$key][self::KEY_VAL];
- }
-
- protected function getWithToken( $key, &$casToken, $flags = 0 ) {
- $casToken = null;
-
- $value = $this->doGet( $key );
- if ( $value !== false ) {
- $casToken = $this->bag[$key][self::KEY_CAS];
- }
+ $casToken = $this->bag[$key][self::KEY_CAS];
- return $
value
;
+ 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] = [
self::KEY_VAL => $value,
// Refresh key position for maxCacheKeys eviction
unset( $this->bag[$key] );
$this->bag[$key] = [
self::KEY_VAL => $value,
- self::KEY_EXP => $this->convertExpiry( $exptime ),
+ self::KEY_EXP => $this->convert
To
Expiry( $exptime ),
self::KEY_CAS => $this->token . ':' . ++self::$casCounter
];
self::KEY_CAS => $this->token . ':' . ++self::$casCounter
];
@@
-105,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;
@@
-130,10
+120,6
@@
class HashBagOStuff extends BagOStuff {
return false;
}
return false;
}
- public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
- return $this->mergeViaCas( $key, $callback, $exptime, $attempts, $flags );
- }
-
/**
* Clear all values in cache
*/
/**
* Clear all values in cache
*/
@@
-151,7
+137,7
@@
class HashBagOStuff extends BagOStuff {
return false;
}
return false;
}
- $this->delete( $key );
+ $this->d
oD
elete( $key );
return true;
}
return true;
}