function cache

Instantiates and statically caches the correct class for a cache bin.

By default, this returns an instance of the Drupal\Core\Cache\DatabaseBackend class.

Classes implementing Drupal\Core\Cache\CacheBackendInterface can register themselves both as a default implementation and for specific bins.

Parameters

$bin: The cache bin for which the cache object should be returned, defaults to 'cache'.

Return value

Drupal\Core\Cache\CacheBackendInterface The cache object associated with the specified bin.

See also

Drupal\Core\Cache\CacheBackendInterface

3 calls to cache()
41 string references to 'cache'

File

drupal/core/includes/cache.inc, line 28
Functions and interfaces for cache handling.

Code

function cache($bin = 'cache') {
  return Drupal::cache($bin);
}