X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2Fobjectcache%2FHashBagOStuff.php;h=348f300c07acce8f5474f74b92f8b0a6e497a322;hb=1880c8401a0638be07a4fe5139ab425eb725e0ee;hp=b4087bed56e2eb1852e6b4ae440ceed63e4b805f;hpb=6c07a09f462147b35e8c76701b5dc6b6140310c8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/objectcache/HashBagOStuff.php b/includes/libs/objectcache/HashBagOStuff.php index b4087bed56..348f300c07 100644 --- a/includes/libs/objectcache/HashBagOStuff.php +++ b/includes/libs/objectcache/HashBagOStuff.php @@ -47,6 +47,9 @@ class HashBagOStuff extends MediumSpecificBagOStuff { /** * @param array $params Additional parameters include: * - maxKeys : only allow this many keys (using oldest-first eviction) + * @codingStandardsIgnoreStart + * @phan-param array{logger?:Psr\Log\LoggerInterface,asyncHandler?:callable,keyspace?:string,reportDupes?:bool,syncTimeout?:int,segmentationSize?:int,segmentedValueMaxSize?:int,maxKeys?:int} $params + * @codingStandardsIgnoreEnd */ function __construct( $params = [] ) { $params['segmentationSize'] = $params['segmentationSize'] ?? INF; @@ -108,10 +111,10 @@ class HashBagOStuff extends MediumSpecificBagOStuff { return true; } - public function incr( $key, $value = 1 ) { + public function incr( $key, $value = 1, $flags = 0 ) { $n = $this->get( $key ); if ( $this->isInteger( $n ) ) { - $n = max( $n + intval( $value ), 0 ); + $n = max( $n + (int)$value, 0 ); $this->bag[$key][self::KEY_VAL] = $n; return $n; @@ -120,6 +123,10 @@ class HashBagOStuff extends MediumSpecificBagOStuff { return false; } + public function decr( $key, $value = 1, $flags = 0 ) { + return $this->incr( $key, -$value, $flags ); + } + /** * Clear all values in cache */