ContextCacheKeys
class ContextCacheKeys extends CacheableMetadata (View source)
A value object to store generated cache keys with its cacheability metadata.
Traits
Trait for \Drupal\Core\Cache\RefinableCacheableDependencyInterface.
Trait for \Drupal\Core\Cache\CacheableDependencyInterface.
Properties
| protected string[] | $cacheContexts | Cache contexts. |
from CacheableDependencyTrait |
| protected string[] | $cacheTags | Cache tags. |
from CacheableDependencyTrait |
| protected int | $cacheMaxAge | Cache max-age. |
from CacheableDependencyTrait |
| protected string[] | $keys | The generated cache keys. |
Methods
Sets cacheability; useful for value object constructors.
Merges the values of another CacheableMetadata object with this one.
Applies the values of this CacheableMetadata object to a render array.
Creates a CacheableMetadata object with values taken from a render array.
Creates a CacheableMetadata object from a depended object.
Constructs a ContextCacheKeys object.
Gets the generated cache keys.
Details
protected $this
setCacheability(CacheableDependencyInterface $cacheability)
Sets cacheability; useful for value object constructors.
getCacheTags()
{@inheritdoc}
getCacheContexts()
{@inheritdoc}
getCacheMaxAge()
{@inheritdoc}
addCacheableDependency($other_object)
{@inheritdoc}
addCacheContexts(array $cache_contexts)
{@inheritdoc}
addCacheTags(array $cache_tags)
{@inheritdoc}
mergeCacheMaxAge($max_age)
{@inheritdoc}
$this
setCacheTags(array $cache_tags)
Sets cache tags.
$this
setCacheContexts(array $cache_contexts)
Sets cache contexts.
$this
setCacheMaxAge(int $max_age)
Sets the maximum age (in seconds).
Defaults to Cache::PERMANENT
CacheableMetadata
merge(CacheableMetadata $other)
Merges the values of another CacheableMetadata object with this one.
applyTo(array $build)
Applies the values of this CacheableMetadata object to a render array.
static CacheableMetadata
createFromRenderArray(array $build)
Creates a CacheableMetadata object with values taken from a render array.
static CacheableMetadata
createFromObject(CacheableDependencyInterface|mixed $object)
Creates a CacheableMetadata object from a depended object.
__construct(array $keys)
Constructs a ContextCacheKeys object.
string[]
getKeys()
Gets the generated cache keys.