annotate core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 4c8ae668cc8c
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Cache;
Chris@0 4
Chris@0 5 /**
Chris@0 6 * Defines an interface for objects which may be used by other cached objects.
Chris@0 7 *
Chris@0 8 * All cacheability metadata exposed in this interface is bubbled to parent
Chris@0 9 * objects when they are cached: if a child object needs to be varied by certain
Chris@0 10 * cache contexts, invalidated by certain cache tags, expire after a certain
Chris@0 11 * maximum age, then so should any parent object.
Chris@0 12 *
Chris@0 13 * @ingroup cache
Chris@0 14 */
Chris@0 15 interface CacheableDependencyInterface {
Chris@0 16
Chris@0 17 /**
Chris@0 18 * The cache contexts associated with this object.
Chris@0 19 *
Chris@0 20 * These identify a specific variation/representation of the object.
Chris@0 21 *
Chris@0 22 * Cache contexts are tokens: placeholders that are converted to cache keys by
Chris@0 23 * the @cache_contexts_manager service. The replacement value depends on the
Chris@0 24 * request context (the current URL, language, and so on). They're converted
Chris@0 25 * before storing an object in cache.
Chris@0 26 *
Chris@0 27 * @return string[]
Chris@0 28 * An array of cache context tokens, used to generate a cache ID.
Chris@0 29 *
Chris@0 30 * @see \Drupal\Core\Cache\Context\CacheContextsManager::convertTokensToKeys()
Chris@0 31 */
Chris@0 32 public function getCacheContexts();
Chris@0 33
Chris@0 34 /**
Chris@0 35 * The cache tags associated with this object.
Chris@0 36 *
Chris@0 37 * When this object is modified, these cache tags will be invalidated.
Chris@0 38 *
Chris@0 39 * @return string[]
Chris@0 40 * A set of cache tags.
Chris@0 41 */
Chris@0 42 public function getCacheTags();
Chris@0 43
Chris@0 44 /**
Chris@0 45 * The maximum age for which this object may be cached.
Chris@0 46 *
Chris@0 47 * @return int
Chris@0 48 * The maximum time in seconds that this object may be cached.
Chris@0 49 */
Chris@0 50 public function getCacheMaxAge();
Chris@0 51
Chris@0 52 }