protected function CacheDecoratedResource::newCacheObject in RESTful 7.2
Get the default cache object based on the plugin configuration.
By default, this returns an instance of the DrupalDatabaseCache class. Classes implementing DrupalCacheInterface can register themselves both as a default implementation and for specific bins.
Return value
\DrupalCacheInterface The cache object associated with the specified bin.
See also
1 call to CacheDecoratedResource::newCacheObject()
- CacheDecoratedResource::__construct in src/
Plugin/ resource/ Decorators/ CacheDecoratedResource.php - Constructs a Drupal\Component\Plugin\PluginBase object.
File
- src/
Plugin/ resource/ Decorators/ CacheDecoratedResource.php, line 75 - Contains \Drupal\restful\Plugin\resource\Decorators\CacheDecoratedResource
Class
Namespace
Drupal\restful\Plugin\resource\DecoratorsCode
protected function newCacheObject() {
// We do not use drupal_static() here because we do not want to change the
// storage of a cache bin mid-request.
static $cache_object;
if (isset($cache_object)) {
// Return cached object.
return $cache_object;
}
$cache_info = $this
->defaultCacheInfo();
$class_name = empty($cache_info['class']) ? NULL : $cache_info['class'];
// If there is no class name in the plugin definition, try to get it from
// the variables.
if (empty($class_name)) {
$class_name = variable_get('cache_class_' . $cache_info['bin']);
}
// If it is still empty, then default to drupal's default cache class.
if (empty($class_name)) {
$class_name = variable_get('cache_default_class', 'DrupalDatabaseCache');
}
$cache_object = new $class_name($cache_info['bin']);
return $cache_object;
}