lithium\storage\Session::clear()

public static method

Clears all keys from a single adapter (if a 'name' options is specified) or all session adapters.

Parameters

  • array $options

    Optional parameters that this method accepts:

    • 'name' string: To force the write 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 to true.

Filter

This method can be filtered.

Source

	public static function clear(array $options = array()) {
		$defaults = array('name' => null, 'strategies' => true);
		$options += $defaults;
		$methods = array();

		if ($name = $options['name']) {
			$methods = array($name => static::adapter($name)->clear($options));
		} else {
			foreach (static::$_configurations as $name => $config) {
				if ($method = static::adapter($name)->clear($options)) {
					$methods[$name] = $method;
				}
			}
		}
		$params = compact('options');
		$result = false;

		foreach ($methods as $name => $method) {
			$settings = static::_config($name);
			$filters = $settings['filters'];
			$result = static::_filter(__FUNCTION__, $params, $method, $filters) || $result;
		}
		if ($options['strategies']) {
			$options += array('mode' => 'LIFO', 'class' => __CLASS__);
			return static::applyStrategies(__FUNCTION__, $name, $result, $options);
		}
		return $result;
	}