lithium\storage\cache\adapter\File::decrement()
Implements
lithium\storage\cache\Adapter::decrement()
Performs a decrement operation on a specified numeric cache item.
Parameters
-
string
$key
Key of numeric cache item to decrement.
-
integer
$offset
Offset to decrement - defaults to
1
.
Returns
integer|booleanThe item's new value on successful decrement, else false
.
Source
public function decrement($key, $offset = 1) {
if ($this->_config['scope']) {
$key = "{$this->_config['scope']}_{$key}";
}
if (!$result = $this->_read($key)) {
return false;
}
if (!$this->_write($key, $result['value'] -= $offset, $result['expiry'])) {
return false;
}
return $result['value'];
}