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

public method

Read values from the cache. Will attempt to return an array of data containing key/value pairs of the requested data.

Invalidates and cleans up expired items on-the-fly when found.

Parameters

  • array $keys

    Keys to uniquely identify the cached items.

Returns

array

Cached values keyed by cache keys on successful read, keys which could not be read will not be included in the results array.

Source

	public function read(array $keys) {
		if ($this->_config['scope']) {
			$keys = $this->_addScopePrefix($this->_config['scope'], $keys, '_');
		}
		$results = [];

		foreach ($keys as $key) {
			if (!$item = $this->_read($key, $this->_config['streams'])) {
				continue;
			}
			if ($item['expiry'] < time() && $item['expiry'] != 0) {
				$this->_delete($key);
				continue;
			}
			$results[$key] = $item['value'];
		}
		if ($this->_config['scope']) {
			$results = $this->_removeScopePrefix($this->_config['scope'], $results, '_');
		}
		return $results;
	}