lithium\storage\cache\adapter\File::increment()
Implements
lithium\storage\cache\Adapter::increment()
Performs an increment operation on a specified numeric cache item.
Parameters
-
string
$key
Key of numeric cache item to increment
-
integer
$offset
Offset to increment - defaults to
1
.
Returns
integer|booleanThe item's new value on successful increment, else false
.
Source
public function increment($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'];
}