lithium\storage\Cache::delete()
Deletes using the specified cache configuration.
Can handle single- and multi-key deletes.
Parameters
-
string
$nameThe cache configuration to delete from.
-
mixed
$keyKey to be deleted or an array of keys to delete.
-
array
$optionsOptions for the method and strategies.
'conditions'mixed: A function or item that must return or evaluate totruein order to continue write operation.
Returns
booleantrue on successful cache delete, false otherwise. When deleting
multiple items and an error occurs deleting any of the items the
whole operation fails and this method will return false.
Filter
This method can be filtered.
Source
public static function delete($name, $key, array $options = []) {
$options += ['conditions' => null, 'strategies' => true];
if (is_callable($options['conditions']) && !$options['conditions']()) {
return false;
}
$adapter = static::adapter($name);
if (is_array($key)) {
$keys = $key;
} else {
$keys = [$key];
}
$params = compact('keys');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) use ($adapter) {
return $adapter->delete($params['keys']);
});
}