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

public method

Cleans entire cache running garbage collection on it. Please note that a scope - in case one is set - is not honored.

The operation will continue to remove keys even if removing one single key fails, cleaning thoroughly as possible.

Returns

boolean

true on successful cleaning, false if failed partially or entirely.

Source

	public function clean() {
		$result = true;
		foreach (new DirectoryIterator($this->_config['path']) as $file) {
			if (!$file->isFile()) {
				continue;
			}
			if (!$item = $this->_read($key = $file->getBasename())) {
				continue;
			}
			if ($item['expiry'] > time()) {
				continue;
			}
			$result = $this->_delete($key) && $result;
		}
		return $result;
	}