function CacheTestTrait::getRenderVariationCache

Retrieves the render cache backend as a variation cache.

This is how Drupal\Core\Render\RenderCache uses the render cache backend.

Return value

\Drupal\Core\Cache\VariationCacheInterface The render cache backend as a variation cache.

2 calls to CacheTestTrait::getRenderVariationCache()
CacheTestTrait::verifyRenderCache in core/modules/system/tests/src/Traits/CacheTestTrait.php
Verify that a given render cache entry exists with the correct cache tags.
EntityCacheTagsTestBase::getRenderCacheBackend in core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php
Retrieves the render cache backend as a variation cache.

File

core/modules/system/tests/src/Traits/CacheTestTrait.php, line 23

Class

CacheTestTrait
Provides helper methods for interacting with cache backends.

Namespace

Drupal\Tests\system\Traits

Code

protected function getRenderVariationCache() : VariationCacheInterface {
    
    /** @var \Drupal\Core\Cache\VariationCacheFactoryInterface $variation_cache_factory */
    $variation_cache_factory = \Drupal::service('variation_cache_factory');
    return $variation_cache_factory->get('render');
}

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