function _drush_cache_get_object

8.0.x cache.inc _drush_cache_get_object($bin)
6.x cache.inc _drush_cache_get_object($bin)
7.x cache.inc _drush_cache_get_object($bin)
5.x cache.inc _drush_cache_get_object($bin)
master cache.inc _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.

Parameters

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

\Drush\Cache\CacheInterface

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

File

includes/cache.inc, line 43
Drush cache API

Code

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];
}