Write value(s) to the cache

Parameters

  • string $key The key to uniquely identify the cached item
  • mixed $data The value to be cached
  • null|string $expiry A strtotime() compatible cache time. 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, $data, $expiry = null) {
		$expiry = ($expiry) ?: $this->_config['expiry'];

		return function($self, $params) use ($expiry) {
			return xcache_set($params['key'], $params['data'], strtotime($expiry) - time());
		};
	}