W3cubDocs

/Drupal 8

public static function Drupal::cache

public static Drupal::cache($bin = 'default')

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

Cache API
Information about the Drupal Cache API

File

core/lib/Drupal.php, line 298
Contains \Drupal.

Class

Drupal
Static Service Container wrapper.

Code

public static function cache($bin = 'default') {
  return static::getContainer()->get('cache.' . $bin);
}

© 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.php/function/Drupal::cache/8.1.x