Security update for Core, with self-updated composer
[yaffs-website] / web / core / lib / Drupal / Component / FileCache / FileCacheInterface.php
1 <?php
2
3 namespace Drupal\Component\FileCache;
4
5 /**
6  * Interface for objects that allow caching file data.
7  *
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.
11  *
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.
15  */
16 interface FileCacheInterface {
17
18   /**
19    * Gets data based on a filename.
20    *
21    * @param string $filepath
22    *   Path of the file that the cached data is based on.
23    *
24    * @return mixed|null
25    *   The data that was persisted with set() or NULL if there is no data
26    *   or the file has been modified.
27    */
28   public function get($filepath);
29
30   /**
31    * Gets data based on filenames.
32    *
33    * @param string[] $filepaths
34    *   List of file paths used as cache identifiers.
35    *
36    * @return array
37    *   List of cached data keyed by the passed in file paths.
38    */
39   public function getMultiple(array $filepaths);
40
41   /**
42    * Stores data based on a filename.
43    *
44    * @param string $filepath
45    *   Path of the file that the cached data is based on.
46    * @param mixed $data
47    *   The data that should be cached.
48    */
49   public function set($filepath, $data);
50
51   /**
52    * Deletes data from the cache.
53    *
54    * @param string $filepath
55    *   Path of the file that the cached data is based on.
56    */
57   public function delete($filepath);
58
59 }