Writes to the specified cache configuration.

Parameters

  • string $name Configuration to be used for writing
  • mixed $key Key to uniquely identify the cache entry
  • mixed $data Data to be cached
  • string $expiry A strtotime() compatible cache time
  • mixed $options Options for the method, filters and strategies.

Returns

boolean True on successful cache write, false otherwise
This method can be filtered.

Source

						public static function write($name, $key, $data, $expiry = null, array $options = array()) {
		$options += array('conditions' => null, 'strategies' => true);
		$settings = static::config();

		if (!isset($settings[$name])) {
			return false;
		}
		$conditions = $options['conditions'];

		if (is_callable($conditions) && !$conditions()) {
			return false;
		}
		$key = static::key($key, $data);

		if (is_array($key)) {
			$expiry = $data;
			$data = null;
		}

		if ($options['strategies']) {
			$options = array('key' => $key, 'class' => __CLASS__);
			$data = static::applyStrategies(__FUNCTION__, $name, $data, $options);
		}

		$method = static::adapter($name)->write($key, $data, $expiry);
		$params = compact('key', 'data', 'expiry');
		return static::_filter(__FUNCTION__, $params, $method, $settings[$name]['filters']);
	}