/**
* @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;
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;
return false;
}
+ public function decr( $key, $value = 1, $flags = 0 ) {
+ return $this->incr( $key, -$value, $flags );
+ }
+
/**
* Clear all values in cache
*/