Write value(s) to the cache.
This adapter method supports multi-key write. By specifying `$key` as an associative array of key/value pairs, `$data` is ignored and all keys that are cached will receive an expiration time of `$expiry`.

Parameters

  • string|array $key The key to uniquely identify the cached item.
  • mixed $value The value to be cached.
  • mixed $expiry A Unix timestamp or `strtotime()`-compatible string indicating when `$value` should expire. If no expiry time is set, then the default cache expiration time set with the cache configuration will be used.

Returns

closure Function returning boolean `true` on successful write, `false` otherwise.

Source

						public function write($key, $value, $expiry = null) {
		$connection =& $this->connection;
		$expiry = ($expiry) ?: $this->_config['expiry'];

		return function($self, $params) use (&$connection, $expiry) {
			$expires = is_int($expiry) ? $expiry : strtotime($expiry);
			$key = $params['key'];

			if (is_array($key)) {
				return $connection->setMulti($key, $expires);
			}
			return $connection->set($key, $params['data'], $expires);
		};
	}