ContextCacheKeys.php

Same filename in other branches
  1. 9 core/lib/Drupal/Core/Cache/Context/ContextCacheKeys.php
  2. 10 core/lib/Drupal/Core/Cache/Context/ContextCacheKeys.php
  3. 11.x core/lib/Drupal/Core/Cache/Context/ContextCacheKeys.php

Namespace

Drupal\Core\Cache\Context

File

core/lib/Drupal/Core/Cache/Context/ContextCacheKeys.php

View source
<?php

namespace Drupal\Core\Cache\Context;

use Drupal\Core\Cache\CacheableMetadata;

/**
 * A value object to store generated cache keys with its cacheability metadata.
 */
class ContextCacheKeys extends CacheableMetadata {
    
    /**
     * The generated cache keys.
     *
     * @var string[]
     */
    protected $keys;
    
    /**
     * Constructs a ContextCacheKeys object.
     *
     * @param string[] $keys
     *   The cache context keys.
     */
    public function __construct(array $keys) {
        $this->keys = $keys;
    }
    
    /**
     * Gets the generated cache keys.
     *
     * @return string[]
     *   The cache keys.
     */
    public function getKeys() {
        return $this->keys;
    }

}

Classes

Title Deprecated Summary
ContextCacheKeys A value object to store generated cache keys with its cacheability metadata.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.