You are here

interface CacheableInterface in Render cache 7.2

Defines an interface for objects which are potentially cacheable.

Hierarchy

Expanded class hierarchy of CacheableInterface

All classes that implement CacheableInterface

1 file declares its use of CacheableInterface
RenderStack.php in src/Cache/RenderStack.php
Contains \Drupal\render_cache\Cache\RenderStack

File

lib/Drupal/Core/Cache/CacheableInterface.php, line 14
Contains \Drupal\Core\CacheableInterface

Namespace

Drupal\Core\Cache
View source
interface CacheableInterface {

  /**
   * The cache keys associated with this potentially cacheable object.
   *
   * Cache keys may either be static (just strings) or tokens (placeholders
   * that are converted to static keys by the @cache_contexts service, depending
   * depending on the request).
   *
   * @return array
   *   An array of strings or cache context tokens, used to generate a cache ID.
   *
   * @see \Drupal\Core\Cache\CacheContexts::convertTokensToKeys()
   */
  public function getCacheKeys();

  /**
   * The cache tags associated with this potentially cacheable object.
   *
   * @return array
   *  An array of cache tags.
   */
  public function getCacheTags();

  /**
   * The maximum age for which this object may be cached.
   *
   * @return int
   *   The maximum time in seconds that this object may be cached.
   */
  public function getCacheMaxAge();

  /**
   * Indicates whether this object is cacheable.
   *
   * @return bool
   *   Returns TRUE if the object is cacheable, FALSE otherwise.
   */
  public function isCacheable();

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableInterface::getCacheKeys public function The cache keys associated with this potentially cacheable object. 1
CacheableInterface::getCacheMaxAge public function The maximum age for which this object may be cached. 1
CacheableInterface::getCacheTags public function The cache tags associated with this potentially cacheable object. 1
CacheableInterface::isCacheable public function Indicates whether this object is cacheable. 1