You are here

interface CacheContextInterface in Render cache 7.2

Provides an interface for defining a cache context service.

Hierarchy

Expanded class hierarchy of CacheContextInterface

All classes that implement CacheContextInterface

File

lib/Drupal/Core/Cache/CacheContextInterface.php, line 13
Contains \Drupal\Core\Cache\CacheContextInterface.

Namespace

Drupal\Core\Cache
View source
interface CacheContextInterface {

  /**
   * Returns the label of the cache context.
   *
   * @return string
   *   The label of the cache context.
   */
  public static function getLabel();

  /**
   * Returns the string representation of the cache context.
   *
   * A cache context service's name is used as a token (placeholder) cache key,
   * and is then replaced with the string returned by this method.
   *
   * @return string
   *   The string representation of the cache context.
   */
  public function getContext();

}

Members

Namesort descending Modifiers Type Description Overrides
CacheContextInterface::getContext public function Returns the string representation of the cache context.
CacheContextInterface::getLabel public static function Returns the label of the cache context.