Commit 3a5e9974 authored by catch's avatar catch

Issue #2221065 by damiankloip, Wim Leers, Berdir: Rename default 'cache' cache bin to 'default'.

parent be94d4e0
......@@ -39,13 +39,13 @@ services:
factory_method: get
factory_service: cache_factory
arguments: [config]
cache.cache:
cache.default:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [cache]
arguments: [default]
cache.entity:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
......@@ -146,7 +146,7 @@ services:
class: Drupal\Core\Path\AliasWhitelist
tags:
- { name: needs_destruction }
arguments: [path_alias_whitelist, '@cache.cache', '@lock', '@state', '@database']
arguments: [path_alias_whitelist, '@cache.default', '@lock', '@state', '@database']
path.alias_manager:
class: Drupal\Core\Path\AliasManager
arguments: ['@path.crud', '@path.alias_whitelist', '@language_manager']
......@@ -178,16 +178,16 @@ services:
- { name: persist }
default_plugin_manager:
abstract: true
arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
module_handler:
class: Drupal\Core\Extension\CachedModuleHandler
arguments: ['%container.modules%', '@state', '@cache.bootstrap']
theme_handler:
class: Drupal\Core\Extension\ThemeHandler
arguments: ['@config.factory', '@module_handler', '@cache.cache', '@info_parser', '@config.installer', '@router.builder']
arguments: ['@config.factory', '@module_handler', '@cache.default', '@info_parser', '@config.installer', '@router.builder']
entity.manager:
class: Drupal\Core\Entity\EntityManager
arguments: ['@container.namespaces', '@service_container', '@module_handler', '@cache.cache', '@language_manager', '@string_translation']
arguments: ['@container.namespaces', '@service_container', '@module_handler', '@cache.default', '@language_manager', '@string_translation']
tags:
- { name: plugin_manager_cache_clear }
entity.form_builder:
......@@ -195,13 +195,13 @@ services:
arguments: ['@entity.manager', '@form_builder']
plugin.manager.field.field_type:
class: Drupal\Core\Field\FieldTypePluginManager
arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
plugin.manager.field.widget:
class: Drupal\Core\Field\WidgetPluginManager
arguments: ['@container.namespaces', '@cache.cache', '@module_handler', '@language_manager', '@plugin.manager.field.field_type']
arguments: ['@container.namespaces', '@cache.default', '@module_handler', '@language_manager', '@plugin.manager.field.field_type']
plugin.manager.field.formatter:
class: Drupal\Core\Field\FormatterPluginManager
arguments: ['@container.namespaces', '@cache.cache', '@module_handler', '@language_manager', '@plugin.manager.field.field_type']
arguments: ['@container.namespaces', '@cache.default', '@module_handler', '@language_manager', '@plugin.manager.field.field_type']
plugin.manager.archiver:
class: Drupal\Core\Archiver\ArchiverManager
parent: default_plugin_manager
......@@ -210,13 +210,13 @@ services:
arguments: ['@container.namespaces']
plugin.manager.menu.local_action:
class: Drupal\Core\Menu\LocalActionManager
arguments: ['@controller_resolver', '@request', '@router.route_provider', '@module_handler', '@cache.cache', '@language_manager', '@access_manager', '@current_user']
arguments: ['@controller_resolver', '@request', '@router.route_provider', '@module_handler', '@cache.default', '@language_manager', '@access_manager', '@current_user']
plugin.manager.menu.local_task:
class: Drupal\Core\Menu\LocalTaskManager
arguments: ['@controller_resolver', '@request', '@router.route_provider', '@router.builder', '@module_handler', '@cache.cache', '@language_manager', '@access_manager', '@current_user']
arguments: ['@controller_resolver', '@request', '@router.route_provider', '@router.builder', '@module_handler', '@cache.default', '@language_manager', '@access_manager', '@current_user']
plugin.manager.menu.contextual_link:
class: Drupal\Core\Menu\ContextualLinkManager
arguments: ['@controller_resolver', '@module_handler', '@cache.cache', '@language_manager', '@access_manager', '@current_user', '@request_stack']
arguments: ['@controller_resolver', '@module_handler', '@cache.default', '@language_manager', '@access_manager', '@current_user', '@request_stack']
plugin.cache_clearer:
class: Drupal\Core\Plugin\CachedDiscoveryClearer
request:
......@@ -604,7 +604,7 @@ services:
arguments: ['@database', '@request']
plugin.manager.mail:
class: Drupal\Core\Mail\MailManager
arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', '@config.factory']
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@module_handler', '@config.factory']
plugin.manager.condition:
class: Drupal\Core\Condition\ConditionManager
parent: default_plugin_manager
......@@ -620,7 +620,7 @@ services:
- { name: event_subscriber }
image.toolkit.manager:
class: Drupal\Core\ImageToolkit\ImageToolkitManager
arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@config.factory', '@module_handler']
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@config.factory', '@module_handler']
image.factory:
class: Drupal\Core\Image\ImageFactory
arguments: ['@image.toolkit.manager']
......@@ -699,7 +699,7 @@ services:
class: Zend\Feed\Writer\Extension\WellFormedWeb\Renderer\Entry
theme.registry:
class: Drupal\Core\Theme\Registry
arguments: ['@cache.cache', '@lock', '@module_handler']
arguments: ['@cache.default', '@lock', '@module_handler']
tags:
- { name: needs_destruction }
authentication:
......@@ -742,6 +742,6 @@ services:
class: Drupal\Core\Asset\AssetDumper
library.discovery:
class: Drupal\Core\Asset\LibraryDiscovery
arguments: ['@cache.cache', '@module_handler']
arguments: ['@cache.default', '@module_handler']
info_parser:
class: Drupal\Core\Extension\InfoParser
......@@ -3480,7 +3480,8 @@ function drupal_render_page($page) {
* required. If 'cid' is set, 'keys' is ignored. Use only if you have
* special requirements.
* - 'expire': Set to one of the cache lifetime constants.
* - 'bin': Specify a cache bin to cache the element in. Default is 'cache'.
* - 'bin': Specify a cache bin to cache the element in. Default is
* 'default'.
* - If this element has #type defined and the default attributes for this
* element have not already been merged in (#defaults_loaded = TRUE) then
* the defaults for this type of element, defined in hook_element_info(),
......@@ -4429,7 +4430,7 @@ function watchdog_severity_levels() {
* - Clears all persistent caches:
* - The bootstrap cache bin containing base system, module system, and theme
* system information.
* - The common 'cache' cache bin containing arbitrary caches.
* - The common 'default' cache bin containing arbitrary caches.
* - The page cache.
* - The URL alias path cache.
* - Resets all static variables that have been defined via drupal_static().
......
......@@ -221,14 +221,14 @@ public static function database() {
*
* @param string $bin
* (optional) The cache bin for which the cache object should be returned,
* defaults to 'cache'.
* defaults to 'default'.
*
* @return \Drupal\Core\Cache\CacheBackendInterface
* The cache object associated with the specified bin.
*
* @ingroup cache
*/
public static function cache($bin = 'cache') {
public static function cache($bin = 'default') {
return static::$container->get('cache.' . $bin);
}
......
......@@ -50,7 +50,7 @@ function __construct(Settings $settings) {
*/
public function get($bin) {
$cache_settings = $this->settings->get('cache');
if (isset($cache_settings[$bin])) {
if (isset($cache_settings['bins'][$bin])) {
$service_name = $cache_settings[$bin];
}
elseif (isset($cache_settings['default'])) {
......
......@@ -42,11 +42,9 @@ class DatabaseBackend implements CacheBackendInterface {
* The cache bin for which the object is created.
*/
public function __construct(Connection $connection, $bin) {
// All cache tables should be prefixed with 'cache_', except for the
// default 'cache' bin.
if ($bin != 'cache') {
$bin = 'cache_' . $bin;
}
// All cache tables should be prefixed with 'cache_'.
$bin = 'cache_' . $bin;
$this->bin = $bin;
$this->connection = $connection;
}
......
......@@ -147,12 +147,12 @@ protected function entityFormBuilder() {
*
* @param string $bin
* (optional) The cache bin for which the cache object should be returned,
* defaults to 'cache'.
* defaults to 'default'.
*
* @return \Drupal\Core\Cache\CacheBackendInterface
* The cache object associated with the specified bin.
*/
protected function cache($bin = 'cache') {
protected function cache($bin = 'default') {
return $this->container()->get('cache.' . $bin);
}
......
......@@ -43,7 +43,7 @@ public function register(ContainerBuilder $container) {
$container->register('theme_handler', 'Drupal\Core\Extension\ThemeHandler')
->addArgument(new Reference('config.factory'))
->addArgument(new Reference('module_handler'))
->addArgument(new Reference('cache.cache'))
->addArgument(new Reference('cache.default'))
->addArgument(new Reference('info_parser'));
}
}
......
......@@ -157,7 +157,7 @@ public function __construct(\Traversable $namespaces, ContainerInterface $contai
$this->discovery = new AnnotatedClassDiscovery('Entity', $namespaces, 'Drupal\Core\Entity\Annotation\EntityType');
$this->discovery = new InfoHookDecorator($this->discovery, 'entity_type_build');
$this->discovery = new AlterDecorator($this->discovery, 'entity_type');
$this->discovery = new CacheDecorator($this->discovery, 'entity_type:' . $this->languageManager->getCurrentLanguage()->id, 'cache', Cache::PERMANENT, array('entity_types' => TRUE));
$this->discovery = new CacheDecorator($this->discovery, 'entity_type:' . $this->languageManager->getCurrentLanguage()->id, 'default', Cache::PERMANENT, array('entity_types' => TRUE));
$this->container = $container;
}
......
......@@ -75,7 +75,7 @@ class CacheDecorator implements CachedDiscoveryInterface {
* @param array $cache_tags
* The cache tags associated with the definition list.
*/
public function __construct(DiscoveryInterface $decorated, $cache_key, $cache_bin = 'cache', $cache_expire = Cache::PERMANENT, array $cache_tags = array()) {
public function __construct(DiscoveryInterface $decorated, $cache_key, $cache_bin = 'default', $cache_expire = Cache::PERMANENT, array $cache_tags = array()) {
$this->decorated = $decorated;
$this->cacheKey = $cache_key;
$this->cacheBin = $cache_bin;
......
services:
plugin.manager.aggregator.fetcher:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [fetcher, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
arguments: [fetcher, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
plugin.manager.aggregator.parser:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [parser, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
arguments: [parser, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
plugin.manager.aggregator.processor:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [processor, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
arguments: [processor, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
aggregator.items.importer:
class: Drupal\aggregator\ItemsImporter
arguments: ['@config.factory', '@plugin.manager.aggregator.fetcher', '@plugin.manager.aggregator.parser', '@plugin.manager.aggregator.processor']
services:
plugin.manager.block:
class: Drupal\block\Plugin\Type\BlockManager
arguments: ['@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', '@string_translation']
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@module_handler', '@string_translation']
theme.negotiator.block.admin_demo:
class: Drupal\block\Theme\AdminDemoNegotiator
tags:
......
......@@ -20,7 +20,7 @@ services:
plugin.manager.config_translation.mapper:
class: Drupal\config_translation\ConfigMapperManager
arguments:
- '@cache.cache'
- '@cache.default'
- '@language_manager'
- '@module_handler'
- '@config.typed'
......
services:
field.info:
class: Drupal\field\FieldInfo
arguments: ['@cache.cache', '@config.factory', '@module_handler', '@plugin.manager.field.field_type', '@language_manager']
arguments: ['@cache.default', '@config.factory', '@module_handler', '@plugin.manager.field.field_type', '@language_manager']
......@@ -122,7 +122,7 @@ function setUp() {
'bundle' => 'entity_test',
))->save();
$link_manager = new LinkManager(new TypeLinkManager(new MemoryBackend('cache')), new RelationLinkManager(new MemoryBackend('cache'), \Drupal::entityManager()));
$link_manager = new LinkManager(new TypeLinkManager(new MemoryBackend('default')), new RelationLinkManager(new MemoryBackend('default'), \Drupal::entityManager()));
$chain_resolver = new ChainEntityResolver(array(new UuidResolver(), new TargetIdResolver()));
......
services:
plugin.manager.language_negotiation_method:
class: Drupal\language\LanguageNegotiationMethodManager
arguments: ['@container.namespaces', '@cache.cache', '@module_handler']
arguments: ['@container.namespaces', '@cache.default', '@module_handler']
language_negotiator:
class: Drupal\language\LanguageNegotiator
arguments: ['@language_manager', '@plugin.manager.language_negotiation_method', '@config.factory', '@settings']
......
......@@ -12,7 +12,7 @@ services:
arguments: ['@database']
string_translator.locale.lookup:
class: Drupal\locale\LocaleTranslation
arguments: ['@locale.storage', '@cache.cache', '@lock', '@config.factory', '@language_manager']
arguments: ['@locale.storage', '@cache.default', '@lock', '@config.factory', '@language_manager']
tags:
- { name: string_translator }
- { name: needs_destruction }
......@@ -8,19 +8,19 @@ services:
arguments: [migrate]
plugin.manager.migrate.source:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [source, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateSource']
arguments: [source, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateSource']
plugin.manager.migrate.process:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [process, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin']
arguments: [process, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin']
plugin.manager.migrate.destination:
class: Drupal\migrate\Plugin\MigrateDestinationPluginManager
arguments: [destination, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler', '@entity.manager']
arguments: [destination, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler', '@entity.manager']
plugin.manager.migrate.id_map:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [id_map, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
arguments: [id_map, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
plugin.manager.migrate.entity_field:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [entity_field, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
arguments: [entity_field, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
password_migrate:
class: Drupal\migrate\MigratePassword
arguments: ['@password_original']
services:
plugin.manager.migrate.load:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [load, '@container.namespaces', '@cache.cache', '@language_manager', '@module_handler']
\ No newline at end of file
arguments: [load, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
......@@ -18,7 +18,7 @@ services:
arguments: ['@rest.link_manager.type', '@rest.link_manager.relation']
rest.link_manager.type:
class: Drupal\rest\LinkManager\TypeLinkManager
arguments: ['@cache.cache']
arguments: ['@cache.default']
rest.link_manager.relation:
class: Drupal\rest\LinkManager\RelationLinkManager
arguments: ['@cache.cache', '@entity.manager']
arguments: ['@cache.default', '@entity.manager']
......@@ -226,8 +226,8 @@
*
* When you request a cache object, you can specify the bin name in your call to
* \Drupal::cache(). Alternatively, you can request a bin by getting service
* "cache.nameofbin" from the container. The default bin is called "cache", with
* service name "cache.cache", it is used to store common and frequently used
* "cache.nameofbin" from the container. The default bin is called "default", with
* service name "cache.default", it is used to store common and frequently used
* caches like plugin information.
*
* Other common cache bins are the following:
......@@ -310,18 +310,18 @@
* though so that all cached data, or that of an individual cache bin, uses a
* different cache backend, such as APC or Memcache, for storage.
*
* In a settings.php file, you can override the class used for a particular
* cache bin. For example, if your implementation of
* \Drupal\Core\Cache\CacheBackendInterface was called MyCustomCache, the
* In a settings.php file, you can override the service used for a particular
* cache bin. For example, if your service implementation of
* \Drupal\Core\Cache\CacheBackendInterface was called cache.custom, the
* following line would make Drupal use it for the 'cache_render' bin:
* @code
* $settings['cache_classes']['cache_render'] = 'Drupal\full\namespace\to\MyCustomCache';
* $settings['cache']['bins']['render'] = 'cache.custom';
* @endcode
*
* Additionally, you can register your cache implementation to be used by
* default for all cache bins with:
* @code
* $settings['cache_classes']['cache'] = 'Drupal\full\namespace\to\MyCustomCache';
* $settings['cache']['default'] = 'cache.custom';
* @endcode
*
* @see https://drupal.org/node/1884796
......
......@@ -165,7 +165,7 @@ function testWhitelist() {
$connection = Database::getConnection();
$this->fixtures->createTables($connection);
$memoryCounterBackend = new MemoryCounterBackend('cache');
$memoryCounterBackend = new MemoryCounterBackend('default');
// Create AliasManager and Path object.
$whitelist = new AliasWhitelist('path_alias_whitelist', $memoryCounterBackend, $this->container->get('lock'), $this->container->get('state'), $connection);
......
......@@ -40,7 +40,7 @@ function testRaceCondition() {
// Directly instantiate the theme registry, this will cause a base cache
// entry to be written in __construct().
$cache = \Drupal::cache('cache');
$cache = \Drupal::cache();
$lock_backend = \Drupal::lock();
$registry = new ThemeRegistry($cid, $cache, $lock_backend, array('theme_registry' => TRUE), $this->container->get('module_handler')->isLoaded());
......
......@@ -33,7 +33,7 @@ public function getFormId() {
* Constructs a \Drupal\condition_test\FormController object.
*/
public function __construct() {
$manager = new ConditionManager(\Drupal::service('container.namespaces'), \Drupal::cache('cache'), \Drupal::service('language_manager'), \Drupal::moduleHandler());
$manager = new ConditionManager(\Drupal::service('container.namespaces'), \Drupal::cache(), \Drupal::service('language_manager'), \Drupal::moduleHandler());
$this->condition = $manager->createInstance('node_type');
}
......
......@@ -25,6 +25,6 @@ public function __construct() {
// The CacheDecorator allows us to cache these plugin definitions for
// quicker retrieval. In this case we are generating a cache key by
// language.
$this->discovery = new CacheDecorator($this->discovery, 'mock_block:' . \Drupal::languageManager()->getCurrentLanguage()->id, 'cache', 1542646800, array('plugin_test'));
$this->discovery = new CacheDecorator($this->discovery, 'mock_block:' . \Drupal::languageManager()->getCurrentLanguage()->id, 'default', 1542646800, array('plugin_test'));
}
}
......@@ -42,7 +42,7 @@ services:
- { name: theme_negotiator, priority: -40 }
user.permissions_hash:
class: Drupal\user\PermissionsHash
arguments: ['@private_key', '@cache.cache']
arguments: ['@private_key', '@cache.default']
user.auth:
class: Drupal\user\UserAuth
arguments: ['@entity.manager', '@password']
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment