public static function Drupal::cache in Drupal 10
Same name and namespace in other branches
- 8 core/lib/Drupal.php \Drupal::cache()
- 9 core/lib/Drupal.php \Drupal::cache()
Returns the requested cache bin.
Parameters
string $bin: (optional) The cache bin for which the cache object should be returned, defaults to 'default'.
Return value
\Drupal\Core\Cache\CacheBackendInterface The cache object associated with the specified bin.
Related topics
54 calls to Drupal::cache()
- AssertPageCacheContextsAndTagsTrait::assertPageCacheContextsAndTags in core/
modules/ system/ tests/ src/ Functional/ Cache/ AssertPageCacheContextsAndTagsTrait.php - Asserts page cache miss, then hit for the given URL; checks cache headers.
- AssertViewsCacheTagsTrait::assertViewsCacheTags in core/
modules/ views/ src/ Tests/ AssertViewsCacheTagsTrait.php - Asserts a view's result & render cache items' cache tags.
- BlockTest::testBlockCacheTags in core/
modules/ block/ tests/ src/ Functional/ BlockTest.php - Tests that cache tags are properly set and bubbled up to the page cache.
- book_uninstall in core/
modules/ book/ book.install - Implements hook_uninstall().
- BreadcrumbFrontCacheContextsTest::setUp in core/
modules/ system/ tests/ src/ Functional/ Menu/ BreadcrumbFrontCacheContextsTest.php
File
- core/
lib/ Drupal.php, line 328
Class
- Drupal
- Static Service Container wrapper.
Code
public static function cache($bin = 'default') {
return static::getContainer()
->get('cache.' . $bin);
}