X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FWinCacheBagOStuff.php;h=5b38628403fa5b6371bb0054cf3a08dccf6b9d3b;hb=fa0f6f34972c0e0f4aac24a03b3efdfc45f256f6;hp=0e4e3fb63d7316281276e79e0cb3e920504c9e25;hpb=7af7bbe7476996bf60d8d8e48a84687ccd7505df;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/WinCacheBagOStuff.php b/includes/libs/objectcache/WinCacheBagOStuff.php index 0e4e3fb63d..5b38628403 100644 --- a/includes/libs/objectcache/WinCacheBagOStuff.php +++ b/includes/libs/objectcache/WinCacheBagOStuff.php @@ -28,6 +28,11 @@ * @ingroup Cache */ class WinCacheBagOStuff extends MediumSpecificBagOStuff { + public function __construct( array $params = [] ) { + $params['segmentationSize'] = $params['segmentationSize'] ?? INF; + parent::__construct( $params ); + } + protected function doGet( $key, $flags = 0, &$casToken = null ) { $casToken = null; @@ -44,7 +49,7 @@ class WinCacheBagOStuff extends MediumSpecificBagOStuff { return $value; } - protected function cas( $casToken, $key, $value, $exptime = 0, $flags = 0 ) { + protected function doCas( $casToken, $key, $value, $exptime = 0, $flags = 0 ) { if ( !wincache_lock( $key ) ) { // optimize with FIFO lock return false; } @@ -76,7 +81,7 @@ class WinCacheBagOStuff extends MediumSpecificBagOStuff { return ( $result === [] || $result === true ); } - public function add( $key, $value, $exptime = 0, $flags = 0 ) { + protected function doAdd( $key, $value, $exptime = 0, $flags = 0 ) { if ( wincache_ucache_exists( $key ) ) { return false; // avoid warnings } @@ -95,14 +100,6 @@ class WinCacheBagOStuff extends MediumSpecificBagOStuff { return true; } - /** - * Construct a cache key. - * - * @since 1.27 - * @param string $keyspace - * @param array $args - * @return string - */ public function makeKeyInternal( $keyspace, $args ) { // WinCache keys have a maximum length of 150 characters. From that, // subtract the number of characters we need for the keyspace and for @@ -131,13 +128,7 @@ class WinCacheBagOStuff extends MediumSpecificBagOStuff { return $keyspace . ':' . implode( ':', $args ); } - /** - * Increase stored value of $key by $value while preserving its original TTL - * @param string $key Key to increase - * @param int $value Value to add to $key (Default 1) - * @return int|bool New value or false on failure - */ - public function incr( $key, $value = 1 ) { + public function incr( $key, $value = 1, $flags = 0 ) { if ( !wincache_lock( $key ) ) { // optimize with FIFO lock return false; } @@ -155,4 +146,8 @@ class WinCacheBagOStuff extends MediumSpecificBagOStuff { return $n; } + + public function decr( $key, $value = 1, $flags = 0 ) { + return $this->incr( $key, -$value, $flags ); + } }