function 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
16 calls to Drupal::cache()
- ConfigurableLanguageManager::__construct in core/
modules/ language/ src/ ConfigurableLanguageManager.php - Constructs a new ConfigurableLanguageManager object.
- ContentEntityCacheTest::testCacheInvalidationOnSave in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ ContentEntityCacheTest.php - Tests that the correct caches are invalidated when an entity is saved.
- ContentEntityCacheTest::testEntityLoad in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ ContentEntityCacheTest.php - Tests the static cache when loading content entities.
- DatabaseBackendTagTest::testTagInvalidations in core/
tests/ Drupal/ KernelTests/ Core/ Cache/ DatabaseBackendTagTest.php - Test tag invalidation.
- DrupalTest::testCache in core/
tests/ Drupal/ Tests/ Core/ DrupalTest.php - Tests the cache() method.
File
-
core/
lib/ Drupal.php, line 350
Class
- Drupal
- Static Service Container wrapper.
Code
public static function cache($bin = 'default') {
return static::getContainer()->get('cache.' . $bin);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.