W3cubDocs

/Drupal 8

public static function Cache::getBins

public static Cache::getBins()

Gets all cache bin services.

Return value

array An array of cache backend objects keyed by cache bins.

File

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

Class

Cache
Helper methods for cache.

Namespace

Drupal\Core\Cache

Code

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

© 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!Cache.php/function/Cache::getBins/8.1.x