Extends
lithium\core\Object
Performs an atomic decrement operation on specified numeric cache item.
Note that if the value of the specified key is *not* an integer, the decrement
operation will have no effect whatsoever. Redis chooses to not typecast values
to integers when performing an atomic decrement operation.
Parameters
- string $key Key of numeric cache item to decrement
- integer $offset Offset to decrement - defaults to 1.
Returns
closure Function returning item's new value on successful decrement, else `false`Source
public function decrement($key, $offset = 1) {
$connection =& $this->connection;
return function($self, $params) use (&$connection, $offset) {
return $connection->decr($params['key'], $offset);
};
}