function Cache::getBins

Same name in other branches
  1. 9 core/lib/Drupal/Core/Cache/Cache.php \Drupal\Core\Cache\Cache::getBins()
  2. 8.9.x core/lib/Drupal/Core/Cache/Cache.php \Drupal\Core\Cache\Cache::getBins()
  3. 11.x core/lib/Drupal/Core/Cache/Cache.php \Drupal\Core\Cache\Cache::getBins()

Gets all cache bin services.

Return value

\Drupal\Core\Cache\CacheBackendInterface[] An array of cache backend objects keyed by cache bins.

9 calls to Cache::getBins()
ClearTest::testFlushAllCaches in core/modules/system/tests/src/Functional/Cache/ClearTest.php
Tests drupal_flush_all_caches().
ConfigTranslationDeleteForm::submitForm in core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php
Form submission handler.
drupal_flush_all_caches in core/includes/common.inc
Rebuilds the container, flushes all persistent caches, resets all variables, and rebuilds all data structures.
ModuleInstaller::uninstall in core/lib/Drupal/Core/Extension/ModuleInstaller.php
OpenTelemetryFrontPagePerformanceTest::clearCaches in core/profiles/demo_umami/tests/src/FunctionalJavascript/OpenTelemetryFrontPagePerformanceTest.php
Clear caches.

... See full list

File

core/lib/Drupal/Core/Cache/Cache.php, line 120

Class

Cache
Helper methods for cache.

Namespace

Drupal\Core\Cache

Code

public static function getBins() {
    $bins = [];
    $container = \Drupal::getContainer();
    foreach ($container->getParameter('cache_bins') as $service_id => $bin) {
        $bins[$bin] = $container->get($service_id);
    }
    return $bins;
}

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