Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Drupal.php

function Drupal::cache

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
1 call to Drupal::cache()
SourcePluginBase::getCache in core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php
Gets the cache object.

File

core/lib/Drupal.php, line 340

Class

Drupal
Static Service Container wrapper.

Code

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