lithium\storage\cache\adapter\File::_write()

protected method

Compiles value to format and writes file.

Parameters

  • string $key

    Key to uniquely identify the cached item.

  • mixed $value

    Value or resource with value to store under given key.

  • integer $expires

    UNIX timestamp after which the item is invalid.

Returns

boolean

true on success, false otherwise.

Source

	protected function _write($key, $value, $expires) {
		$path = "{$this->_config['path']}/{$key}";

		if (!$stream = fopen($path, 'wb')) {
			return false;
		}
		fwrite($stream, "{:expiry:{$expires}}\n");

		if (is_resource($value)) {
			stream_copy_to_stream($value, $stream);
		} else {
			fwrite($stream, $value);
		}
		return fclose($stream);
	}