CalculatedCacheContextInterface.php 998 Bytes
Newer Older
1 2 3 4
<?php

/**
 * @file
5
 * Contains \Drupal\Core\Cache\Context\CacheContextInterface.
6 7
 */

8
namespace Drupal\Core\Cache\Context;
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

/**
 * Provides an interface for defining a calculated cache context service.
 */
interface CalculatedCacheContextInterface {

  /**
   * Returns the label of the cache context.
   *
   * @return string
   *   The label of the cache context.
   *
   * @see Cache
   */
  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.
   *
31 32
   * @param string|null $parameter
   *   The parameter, or NULL to indicate all possible parameter values.
33 34
   *
   * @return string
35 36
   *   The string representation of the cache context. When $parameter is NULL,
   *   a value representing all possible parameters must be generated.
37
   */
38
  public function getContext($parameter = NULL);
39 40

}