X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FWinCacheBagOStuff.php;h=9d7e1436821e5dc1470ee422c63dcc5db76f3262;hb=50a72860b6eab430160a9504926c6aafa4fb701d;hp=818f6f1dc28e9ce8155c4f54edfc04d960281c8f;hpb=242170c3df2b153881c08a9b13d5ea378db67b90;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/WinCacheBagOStuff.php b/includes/libs/objectcache/WinCacheBagOStuff.php index 818f6f1dc2..9d7e143682 100644 --- a/includes/libs/objectcache/WinCacheBagOStuff.php +++ b/includes/libs/objectcache/WinCacheBagOStuff.php @@ -36,7 +36,7 @@ class WinCacheBagOStuff extends BagOStuff { return false; } - $value = unserialize( $blob ); + $value = $this->unserialize( $blob ); if ( $value !== false ) { $casToken = (string)$blob; // don't bother hashing this } @@ -67,19 +67,29 @@ class WinCacheBagOStuff extends BagOStuff { return $success; } - public function set( $key, $value, $expire = 0, $flags = 0 ) { - $result = wincache_ucache_set( $key, serialize( $value ), $expire ); + protected function doSet( $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 ) { - $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 ); } - public function delete( $key, $flags = 0 ) { + protected function doDelete( $key, $flags = 0 ) { wincache_ucache_delete( $key ); return true;