public function ListCacheBinsPass::process

public ListCacheBinsPass::process(ContainerBuilder $container)

Implements CompilerPassInterface::process().

Collects the cache bins into the cache_bins parameter.

Overrides CompilerPassInterface::process

File

core/lib/Drupal/Core/Cache/ListCacheBinsPass.php, line 18

Class

ListCacheBinsPass
Adds cache_bins parameter to the container.

Namespace

Drupal\Core\Cache

Code

public function process(ContainerBuilder $container) {
  $cache_bins = array();
  $cache_default_bin_backends = array();
  foreach ($container->findTaggedServiceIds('cache.bin') as $id => $attributes) {
    $bin = substr($id, strpos($id, '.') + 1);
    $cache_bins[$id] = $bin;
    if (isset($attributes[0]['default_backend'])) {
      $cache_default_bin_backends[$bin] = $attributes[0]['default_backend'];
    }
  }
  $container->setParameter('cache_bins', $cache_bins);
  $container->setParameter('cache_default_bin_backends', $cache_default_bin_backends);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Cache!ListCacheBinsPass.php/function/ListCacheBinsPass::process/8.1.x