function Cache::getMemoryBins

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Cache/Cache.php \Drupal\Core\Cache\Cache::getMemoryBins()

Gets all memory cache bin services.

Return value

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

1 call to Cache::getMemoryBins()
RefreshVariablesTrait::refreshVariables in core/lib/Drupal/Core/Test/RefreshVariablesTrait.php
Refreshes in-memory configuration and state information.

File

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

Class

Cache
Helper methods for cache.

Namespace

Drupal\Core\Cache

Code

public static function getMemoryBins() : array {
  $bins = [];
  $container = \Drupal::getContainer();
  foreach ($container->getParameter('memory_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.