Upgraded drupal core with security updates
[yaffs-website] / web / core / lib / Drupal / Core / Cache / Context / CacheContextInterface.php
1 <?php
2
3 namespace Drupal\Core\Cache\Context;
4
5 /**
6  * Provides an interface for defining a cache context service.
7  */
8 interface CacheContextInterface {
9
10   /**
11    * Returns the label of the cache context.
12    *
13    * @return string
14    *   The label of the cache context.
15    */
16   public static function getLabel();
17
18   /**
19    * Returns the string representation of the cache context.
20    *
21    * A cache context service's name is used as a token (placeholder) cache key,
22    * and is then replaced with the string returned by this method.
23    *
24    * @return string
25    *   The string representation of the cache context.
26    */
27   public function getContext();
28
29   /**
30    * Gets the cacheability metadata for the context.
31    *
32    * There are three valid cases for the returned CacheableMetadata object:
33    * - An empty object means this can be optimized away safely.
34    * - A max-age of 0 means that this context can never be optimized away. It
35    *   will never bubble up and cache tags will not be used.
36    * - Any non-zero max-age and cache tags will bubble up into the cache item
37    *   if this is optimized away to allow for invalidation if the context
38    *   value changes.
39    *
40    *
41    * @return \Drupal\Core\Cache\CacheableMetadata
42    *   A cacheable metadata object.
43    */
44   public function getCacheableMetadata();
45
46 }