lithium\storage\Session::delete()
Deletes a named key from a single adapter (if a 'name'
option is specified) or all
session adapters.
Parameters
-
string
$key
The name of the session key to delete.
-
array
$options
Optional parameters that this method accepts:
'name'
string: To force the delete to a specific adapter, specify the name of the configuration (i.e.'default'
) here.'strategies'
boolean: Indicates whether or not a configuration's applied strategy classes should be enabled for this operation. Defaults totrue
.
Returns
booleanReturns true
on successful delete, or false
on failure.
Filter
This method can be filtered.
Source
public static function delete($key, array $options = array()) {
$defaults = array('name' => null, 'strategies' => true);
$options += $defaults;
$methods = array();
if ($name = $options['name']) {
$methods = array($name => static::adapter($name)->delete($key, $options));
} else {
foreach (static::$_configurations as $name => $config) {
if ($method = static::adapter($name)->delete($key, $options)) {
$methods[$name] = $method;
}
}
}
$result = false;
$options += array('key' => $key, 'class' => __CLASS__);
$original = $key;
foreach ($methods as $name => $method) {
$settings = static::_config($name);
if ($options['strategies']) {
$options += array('key' => $key, 'class' => __CLASS__);
$key = static::applyStrategies(__FUNCTION__, $name, $original, $options);
}
$params = compact('key', 'options');
$filters = $settings['filters'];
$result = static::_filter(__FUNCTION__, $params, $method, $filters) || $result;
}
return $result;
}