CacheableDependencyInterface::getCacheMaxAge

public CacheableDependencyInterface::getCacheMaxAge() The maximum age for which this object may be cached. Return value int The maximum time in seconds that this object may be cached. File core/lib/Drupal/Core/Cache/CacheableDependencyInterface.php, line 50 Class CacheableDependencyInterface Defines an interface for objects which may be used by other cached objects. Namespace Drupal\Core\Cache Code public function getCacheMaxAge();

CacheableDependencyInterface::getCacheContexts

public CacheableDependencyInterface::getCacheContexts() The cache contexts associated with this object. These identify a specific variation/representation of the object. Cache contexts are tokens: placeholders that are converted to cache keys by the @cache_contexts_manager service. The replacement value depends on the request context (the current URL, language, and so on). They're converted before storing an object in cache. Return value string[] An array of cache context tokens, used to gener

CacheableDependencyInterface

Defines an interface for objects which may be used by other cached objects. All cacheability metadata exposed in this interface is bubbled to parent objects when they are cached: if a child object needs to be varied by certain cache contexts, invalidated by certain cache tags, expire after a certain maximum age, then so should any parent object. Hierarchy interface \Drupal\Core\Cache\CacheableDependencyInterface Related topics Cache API Information about the Drupal Cache API File core/lib/

Cache::validateTags

public static Cache::validateTags(array $tags) Validates an array of cache tags. Can be called before using cache tags in operations, to ensure validity. Parameters string[] $tags: An array of cache tags. Throws \LogicException Deprecated Use assert('\Drupal\Component\Assertion\Inspector::assertAllStrings($tags)'); File core/lib/Drupal/Core/Cache/Cache.php, line 103 Class Cache Helper methods for cache. Namespace Drupal\Core\Cache Code public static function validateTags(array $ta

Cache::PERMANENT

Indicates that the item should never be removed unless explicitly deleted. File core/lib/Drupal/Core/Cache/Cache.php, line 17 Class Cache Helper methods for cache. Namespace Drupal\Core\Cache Code const PERMANENT = CacheBackendInterface::CACHE_PERMANENT;

Cache::mergeTags

public static Cache::mergeTags(array $a = [], array $b = []) Merges arrays of cache tags and removes duplicates. The cache tags array is returned in a format that is valid for \Drupal\Core\Cache\CacheBackendInterface::set(). When caching elements, it is necessary to collect all cache tags into a single array, from both the element itself and all child elements. This allows items to be invalidated based on all tags attached to the content they're constituted from. Parameters array $a: Cache tag

Cache::mergeMaxAges

public static Cache::mergeMaxAges($a = Cache::PERMANENT, $b = Cache::PERMANENT) Merges max-age values (expressed in seconds), finds the lowest max-age. Ensures infinite max-age (Cache::PERMANENT) is taken into account. Parameters int $a: Max age value to merge. int $b: Max age value to merge. Return value int The minimum max-age value. File core/lib/Drupal/Core/Cache/Cache.php, line 77 Class Cache Helper methods for cache. Namespace Drupal\Core\Cache Code public static function merge

Cache::mergeContexts

public static Cache::mergeContexts(array $a = [], array $b = []) Merges arrays of cache contexts and removes duplicates. Parameters array $a: Cache contexts array to merge. array $b: Cache contexts array to merge. Return value string[] The merged array of cache contexts. File core/lib/Drupal/Core/Cache/Cache.php, line 30 Class Cache Helper methods for cache. Namespace Drupal\Core\Cache Code public static function mergeContexts(array $a = [], array $b = []) { $cache_contexts = array

Cache::keyFromQuery

public static Cache::keyFromQuery(SelectInterface $query) Generates a hash from a query object, to be used as part of the cache key. This smart caching strategy saves Drupal from querying and rendering to HTML when the underlying query is unchanged. Expensive queries should use the query builder to create the query and then call this function. Executing the query and formatting results should happen in a #pre_render callback. Parameters \Drupal\Core\Database\Query\SelectInterface $query: A sel

Cache::invalidateTags

public static Cache::invalidateTags(array $tags) Marks cache items from all bins with any of the specified tags as invalid. Parameters string[] $tags: The list of tags to invalidate cache items for. File core/lib/Drupal/Core/Cache/Cache.php, line 144 Class Cache Helper methods for cache. Namespace Drupal\Core\Cache Code public static function invalidateTags(array $tags) { \Drupal::service('cache_tags.invalidator')->invalidateTags($tags); }