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 "Expand ResponseFactory"
[lhc/web/wiklou.git]
/
includes
/
libs
/
objectcache
/
WinCacheBagOStuff.php
diff --git
a/includes/libs/objectcache/WinCacheBagOStuff.php
b/includes/libs/objectcache/WinCacheBagOStuff.php
index
fb64d77
..
9d7e143
100644
(file)
--- a/
includes/libs/objectcache/WinCacheBagOStuff.php
+++ b/
includes/libs/objectcache/WinCacheBagOStuff.php
@@
-28,13
+28,7
@@
* @ingroup Cache
*/
class WinCacheBagOStuff extends BagOStuff {
* @ingroup Cache
*/
class WinCacheBagOStuff extends BagOStuff {
- protected function doGet( $key, $flags = 0 ) {
- $blob = wincache_ucache_get( $key );
-
- return is_string( $blob ) ? unserialize( $blob ) : false;
- }
-
- protected function getWithToken( $key, &$casToken, $flags = 0 ) {
+ protected function doGet( $key, $flags = 0, &$casToken = null ) {
$casToken = null;
$blob = wincache_ucache_get( $key );
$casToken = null;
$blob = wincache_ucache_get( $key );
@@
-42,13
+36,11
@@
class WinCacheBagOStuff extends BagOStuff {
return false;
}
return false;
}
- $value = unserialize( $blob );
- if ( $value
=
== false ) {
- return false;
+ $value =
$this->
unserialize( $blob );
+ if ( $value
!
== false ) {
+ $casToken = (string)$blob; // don't bother hashing this
}
}
- $casToken = $blob; // don't bother hashing this
-
return $value;
}
return $value;
}
@@
-58,7
+50,7
@@
class WinCacheBagOStuff extends BagOStuff {
}
$curCasToken = null; // passed by reference
}
$curCasToken = null; // passed by reference
- $this->
getWithToken( $key, $curCasToken, self::READ_LATEST
);
+ $this->
doGet( $key, self::READ_LATEST, $curCasToken
);
if ( $casToken === $curCasToken ) {
$success = $this->set( $key, $value, $exptime, $flags );
} else {
if ( $casToken === $curCasToken ) {
$success = $this->set( $key, $value, $exptime, $flags );
} else {
@@
-75,19
+67,29
@@
class WinCacheBagOStuff extends BagOStuff {
return $success;
}
return $success;
}
- p
ublic function s
et( $key, $value, $expire = 0, $flags = 0 ) {
- $result = wincache_ucache_set( $key, serialize( $value ), $expire );
+ p
rotected function doS
et( $key, $value, $expire = 0, $flags = 0 ) {
+ $result = wincache_ucache_set( $key,
$this->
serialize( $value ), $expire );
+ // false positive, wincache_ucache_set returns an empty array
+ // in some circumstances.
+ // @phan-suppress-next-line PhanTypeComparisonToArray
return ( $result === [] || $result === true );
}
public function add( $key, $value, $exptime = 0, $flags = 0 ) {
return ( $result === [] || $result === true );
}
public function add( $key, $value, $exptime = 0, $flags = 0 ) {
- $result = wincache_ucache_add( $key, serialize( $value ), $exptime );
+ if ( wincache_ucache_exists( $key ) ) {
+ return false; // avoid warnings
+ }
+
+ $result = wincache_ucache_add( $key, $this->serialize( $value ), $exptime );
+ // false positive, wincache_ucache_add returns an empty array
+ // in some circumstances.
+ // @phan-suppress-next-line PhanTypeComparisonToArray
return ( $result === [] || $result === true );
}
return ( $result === [] || $result === true );
}
- p
ublic function d
elete( $key, $flags = 0 ) {
+ p
rotected function doD
elete( $key, $flags = 0 ) {
wincache_ucache_delete( $key );
return true;
wincache_ucache_delete( $key );
return true;