3 namespace Drupal\Component\FileCache;
6 * Interface for objects that allow caching file data.
8 * Parsing YAML, annotations or similar data out of files can be a
9 * time-consuming process, especially since those files usually don't change
10 * and identical data is parsed over and over again.
12 * File cache is a self-contained caching layer for such processing, that relies
13 * on the file modification to ensure that cached data is still up to date and
14 * does not need to be invalidated externally.
16 interface FileCacheInterface {
19 * Gets data based on a filename.
21 * @param string $filepath
22 * Path of the file that the cached data is based on.
25 * The data that was persisted with set() or NULL if there is no data
26 * or the file has been modified.
28 public function get($filepath);
31 * Gets data based on filenames.
33 * @param string[] $filepaths
34 * List of file paths used as cache identifiers.
37 * List of cached data keyed by the passed in file paths.
39 public function getMultiple(array $filepaths);
42 * Stores data based on a filename.
44 * @param string $filepath
45 * Path of the file that the cached data is based on.
47 * The data that should be cached.
49 public function set($filepath, $data);
52 * Deletes data from the cache.
54 * @param string $filepath
55 * Path of the file that the cached data is based on.
57 public function delete($filepath);