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 = []) {
		$defaults = ['name' => null, 'strategies' => true];
		$options += $defaults;
		$methods = [];

		if ($name = $options['name']) {
			$methods = [$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) {
			$result = Filters::run(get_called_class(), __FUNCTION__, $params, $method) || $result;
		}
		if ($options['strategies']) {
			$options += ['mode' => 'LIFO', 'class' => __CLASS__];
			return static::applyStrategies(__FUNCTION__, $name, $result, $options);
		}
		return $result;
	}