interface FileCacheInterface (View source)

Interface for objects that allow caching file data.

Parsing YAML, annotations or similar data out of files can be a time-consuming process, especially since those files usually don't change and identical data is parsed over and over again.

File cache is a self-contained caching layer for such processing, that relies on the file modification to ensure that cached data is still up to date and does not need to be invalidated externally.

Methods

mixed|null
get(string $filepath)

Gets data based on a filename.

array
getMultiple(array $filepaths)

Gets data based on filenames.

set(string $filepath, mixed $data)

Stores data based on a filename.

delete(string $filepath)

Deletes data from the cache.

Details

mixed|null get(string $filepath)

Gets data based on a filename.

Parameters

string $filepath

Path of the file that the cached data is based on.

Return Value

mixed|null

The data that was persisted with set() or NULL if there is no data or the file has been modified.

array getMultiple(array $filepaths)

Gets data based on filenames.

Parameters

array $filepaths

List of file paths used as cache identifiers.

Return Value

array

List of cached data keyed by the passed in file paths.

set(string $filepath, mixed $data)

Stores data based on a filename.

Parameters

string $filepath

Path of the file that the cached data is based on.

mixed $data

The data that should be cached.

delete(string $filepath)

Deletes data from the cache.

Parameters

string $filepath

Path of the file that the cached data is based on.