function _drush_cache_get_object

8.0.x _drush_cache_get_object($bin)
6.x _drush_cache_get_object($bin)
7.x _drush_cache_get_object($bin)
5.x _drush_cache_get_object($bin)
master _drush_cache_get_object($bin)

Get the cache object for a cache bin.

By default, this returns an instance of the \Drush\Cache\FileCache class. Classes implementing \Drush\Cache\CacheInterface can register themselves both as a default implementation and for specific bins.


string $bin: The cache bin for which the cache object should be returned.

Return value

\Drush\Cache\CacheInterface The cache object associated with the specified bin.

See also


5 calls to _drush_cache_get_object()
drush_cache_clear_all in includes/
Expire data from the cache.
drush_cache_get in includes/
Return data from the persistent cache.
drush_cache_get_multiple in includes/
Return data from the persistent cache when given an array of cache IDs.
drush_cache_set in includes/
Store data in the persistent cache.
_drush_cache_is_empty in includes/
Check if a cache bin is empty.


includes/, line 43
Drush cache API


function _drush_cache_get_object($bin) {
  static $cache_objects;

  if (!isset($cache_objects[$bin])) {
    $class = drush_get_option('cache-class-' . $bin, NULL);
    if (!isset($class)) {
      $class = drush_get_option('cache-default-class', '\Drush\Cache\JSONCache');
    $cache_objects[$bin] = new $class($bin);
  return $cache_objects[$bin];