Extends
lithium\core\Adaptable
Performs an atomic decrement operation on specified numeric cache item
from the given cache configuration.
Parameters
- string $name
- string $key Key of numeric cache item to decrement
- integer $offset Offset to decrement - defaults to 1.
- mixed $options Options for this method.
Returns
mixed Item's new value on successful decrement, false otherwise.Source
public static function decrement($name, $key, $offset = 1, array $options = array()) {
$options += array('conditions' => null);
$settings = static::config();
if (!isset($settings[$name])) {
return false;
}
$conditions = $options['conditions'];
if (is_callable($conditions) && !$conditions()) {
return false;
}
$key = static::key($key);
$method = static::adapter($name)->decrement($key, $offset);
$params = compact('key', 'offset');
$filters = $settings[$name]['filters'];
return static::_filter(__FUNCTION__, $params, $method, $filters);
}