Extends
lithium\core\Object
Write value(s) to the cache.
Note: When using an array of keys => values in $key for multi-write,
note that this is not an atomic operation.
Parameters
- string $key The key to uniquely identify the cached item.
- mixed $data The value to be cached.
- string $expiry A strtotime() compatible cache time.
Returns
closure Function returning boolean `true` on successful write, `false` otherwise.Source
public function write($key, $data, $expiry) {
$cache =& $this->_cache;
return function($self, $params) use (&$cache) {
extract($params);
if (is_array($key)) {
foreach ($key as $k => &$v) {
$cache[$k] = $v;
}
return true;
}
return (boolean) ($cache[$key] = $data);
};
}