Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Cache / CacheCollectorInterface.php
1 <?php
2
3 namespace Drupal\Core\Cache;
4
5 /**
6  * Provides a caching wrapper to be used in place of large structures.
7  *
8  * This should be extended by systems that need to cache large amounts of data
9  * to calling functions. These structures can become very large, so this
10  * class is used to allow different strategies to be used for caching internally
11  * (lazy loading, building caches over time etc.). This can dramatically reduce
12  * the amount of data that needs to be loaded from cache backends on each
13  * request, and memory usage from static caches of that same data.
14  *
15  * The default implementation is \Drupal\Core\Cache\CacheCollector.
16  *
17  * @ingroup cache
18  */
19 interface CacheCollectorInterface {
20
21   /**
22    * Gets value from the cache.
23    *
24    * @param string $key
25    *   Key that identifies the data.
26    *
27    * @return mixed
28    *   The corresponding cache data.
29    */
30   public function get($key);
31
32   /**
33    * Sets cache data.
34    *
35    * It depends on the specific case and implementation whether this has a
36    * permanent effect or if it just affects the current request.
37    *
38    * @param string $key
39    *   Key that identifies the data.
40    * @param mixed $value
41    *   The data to be set.
42    */
43   public function set($key, $value);
44
45   /**
46    * Deletes the element.
47    *
48    * It depends on the specific case and implementation whether this has a
49    * permanent effect or if it just affects the current request.
50    *
51    * @param string $key
52    *   Key that identifies the data.
53    */
54   public function delete($key);
55
56   /**
57    * Returns whether data exists for this key.
58    *
59    * @param string $key
60    *   Key that identifies the data.
61    */
62   public function has($key);
63
64   /**
65    * Resets the local cache.
66    *
67    * Does not clear the persistent cache.
68    */
69   public function reset();
70
71   /**
72    * Clears the collected cache entry.
73    */
74   public function clear();
75
76 }