Extends
lithium\core\Object
Read value(s) from the cache
Note: When using an array of keys in $key for multi-read,
note that this is not an atomic operation.
Parameters
- string $key The key to uniquely identify the cached item.
Returns
closure Function returning cached value if successful, `false` otherwise.Source
public function read($key) {
$cache =& $this->_cache;
return function($self, $params) use (&$cache) {
extract($params);
if (is_array($key)) {
$results = array();
foreach ($key as $k) {
if (isset($cache[$k])) {
$results[$k] = $cache[$k];
}
}
return $results;
}
return isset($cache[$key]) ? $cache[$key] : null;
};
}