Commit b1eb0a29 authored by alexpott's avatar alexpott

Issue #2228291 by damiankloip: Move all plugin and other discovery data into a cache_discovery bin.

parent 9a878fb4
......@@ -67,6 +67,13 @@ services:
factory_method: get
factory_service: cache_factory
arguments: [data]
cache.discovery:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin }
factory_method: get
factory_service: cache_factory
arguments: [discovery]
config.cachedstorage.storage:
class: Drupal\Core\Config\FileStorage
factory_class: Drupal\Core\Config\FileStorageFactory
......@@ -183,7 +190,7 @@ services:
- { name: persist }
default_plugin_manager:
abstract: true
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
module_handler:
class: Drupal\Core\Extension\CachedModuleHandler
arguments: ['%container.modules%', '@state', '@cache.bootstrap']
......@@ -192,7 +199,7 @@ services:
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.default', '@language_manager', '@string_translation']
arguments: ['@container.namespaces', '@service_container', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation']
tags:
- { name: plugin_manager_cache_clear }
entity.form_builder:
......@@ -200,13 +207,13 @@ services:
arguments: ['@entity.manager', '@form_builder']
plugin.manager.field.field_type:
class: Drupal\Core\Field\FieldTypePluginManager
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.field.widget:
class: Drupal\Core\Field\WidgetPluginManager
arguments: ['@container.namespaces', '@cache.default', '@module_handler', '@language_manager', '@plugin.manager.field.field_type']
arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@language_manager', '@plugin.manager.field.field_type']
plugin.manager.field.formatter:
class: Drupal\Core\Field\FormatterPluginManager
arguments: ['@container.namespaces', '@cache.default', '@module_handler', '@language_manager', '@plugin.manager.field.field_type']
arguments: ['@container.namespaces', '@cache.discovery', '@module_handler', '@language_manager', '@plugin.manager.field.field_type']
plugin.manager.archiver:
class: Drupal\Core\Archiver\ArchiverManager
parent: default_plugin_manager
......@@ -215,13 +222,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.default', '@language_manager', '@access_manager', '@current_user']
arguments: ['@controller_resolver', '@request', '@router.route_provider', '@module_handler', '@cache.discovery', '@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.default', '@language_manager', '@access_manager', '@current_user']
arguments: ['@controller_resolver', '@request', '@router.route_provider', '@router.builder', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user']
plugin.manager.menu.contextual_link:
class: Drupal\Core\Menu\ContextualLinkManager
arguments: ['@controller_resolver', '@module_handler', '@cache.default', '@language_manager', '@access_manager', '@current_user', '@request_stack']
arguments: ['@controller_resolver', '@module_handler', '@cache.discovery', '@language_manager', '@access_manager', '@current_user', '@request_stack']
plugin.cache_clearer:
class: Drupal\Core\Plugin\CachedDiscoveryClearer
request:
......@@ -610,7 +617,7 @@ services:
arguments: ['@database', '@request_stack']
plugin.manager.mail:
class: Drupal\Core\Mail\MailManager
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@module_handler', '@config.factory']
arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', '@config.factory']
plugin.manager.condition:
class: Drupal\Core\Condition\ConditionManager
parent: default_plugin_manager
......@@ -626,7 +633,7 @@ services:
- { name: event_subscriber }
image.toolkit.manager:
class: Drupal\Core\ImageToolkit\ImageToolkitManager
arguments: ['@container.namespaces', '@cache.default', '@language_manager', '@config.factory', '@module_handler']
arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@config.factory', '@module_handler']
image.factory:
class: Drupal\Core\Image\ImageFactory
arguments: ['@image.toolkit.manager']
......@@ -754,6 +761,6 @@ services:
class: Drupal\Core\Asset\AssetDumper
library.discovery:
class: Drupal\Core\Asset\LibraryDiscovery
arguments: ['@cache.default', '@module_handler']
arguments: ['@cache.discovery', '@module_handler']
info_parser:
class: Drupal\Core\Extension\InfoParser
......@@ -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, 'default', Cache::PERMANENT, array('entity_types' => TRUE));
$this->discovery = new CacheDecorator($this->discovery, 'entity_type:' . $this->languageManager->getCurrentLanguage()->id, 'discovery', Cache::PERMANENT, array('entity_types' => TRUE));
$this->container = $container;
}
......
services:
plugin.manager.aggregator.fetcher:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [fetcher, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
arguments: [fetcher, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.aggregator.parser:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [parser, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
arguments: [parser, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.aggregator.processor:
class: Drupal\aggregator\Plugin\AggregatorPluginManager
arguments: [processor, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
arguments: [processor, '@container.namespaces', '@cache.discovery', '@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.default', '@language_manager', '@module_handler', '@string_translation']
arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', '@string_translation']
theme.negotiator.block.admin_demo:
class: Drupal\block\Theme\AdminDemoNegotiator
tags:
......
services:
field.info:
class: Drupal\field\FieldInfo
arguments: ['@cache.default', '@config.factory', '@module_handler', '@plugin.manager.field.field_type', '@language_manager']
arguments: ['@cache.discovery', '@config.factory', '@module_handler', '@plugin.manager.field.field_type', '@language_manager']
services:
plugin.manager.language_negotiation_method:
class: Drupal\language\LanguageNegotiationMethodManager
arguments: ['@container.namespaces', '@cache.default', '@module_handler']
arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
language_negotiator:
class: Drupal\language\LanguageNegotiator
arguments: ['@language_manager', '@plugin.manager.language_negotiation_method', '@config.factory', '@settings']
......
......@@ -8,19 +8,19 @@ services:
arguments: [migrate]
plugin.manager.migrate.source:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [source, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateSource']
arguments: [source, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateSource']
plugin.manager.migrate.process:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [process, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin']
arguments: [process, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', 'Drupal\migrate\Annotation\MigrateProcessPlugin']
plugin.manager.migrate.destination:
class: Drupal\migrate\Plugin\MigrateDestinationPluginManager
arguments: [destination, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler', '@entity.manager']
arguments: [destination, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler', '@entity.manager']
plugin.manager.migrate.id_map:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [id_map, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
arguments: [id_map, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.migrate.entity_field:
class: Drupal\migrate\Plugin\MigratePluginManager
arguments: [entity_field, '@container.namespaces', '@cache.default', '@language_manager', '@module_handler']
arguments: [entity_field, '@container.namespaces', '@cache.discovery', '@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.default', '@language_manager', '@module_handler']
arguments: [load, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
services:
plugin.manager.rest:
class: Drupal\rest\Plugin\Type\ResourcePluginManager
arguments: ['@container.namespaces', '@cache.rest', '@language_manager', '@module_handler']
arguments: ['@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
cache.rest:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
......
......@@ -228,13 +228,15 @@
* \Drupal::cache(). Alternatively, you can request a bin by getting service
* "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.
* caches.
*
* Other common cache bins are the following:
* - bootstrap: Small caches needed for the bootstrap on every request.
* - render: Contains cached HTML strings like cached pages and blocks, can
* grow to large size.
* - data: Contains data that can vary by path or similar context.
* - discovery: Contains cached discovery data for things such as plugins,
* views_data, or YAML discovered data such as library info.
*
* A module can define a cache bin by defining a service in its
* modulename.services.yml file as follows (substituting the desired name for
......
......@@ -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(), \Drupal::service('language_manager'), \Drupal::moduleHandler());
$manager = new ConditionManager(\Drupal::service('container.namespaces'), \Drupal::cache('discovery'), \Drupal::service('language_manager'), \Drupal::moduleHandler());
$this->condition = $manager->createInstance('node_type');
}
......
......@@ -523,12 +523,20 @@ function views_language_list($field = 'name', $flags = Language::STATE_ALL) {
return $list;
}
/**
* Implements hook_ENTITY_TYPE_create() for 'field_instance_config'.
*/
function views_field_instance_config_create(FieldInstanceConfigInterface $field_instance) {
// @todo: Is this necessary? Use cache tags to only delete Views' cache data?
\Drupal::cache('discovery')->deleteAll();
}
/**
* Implements hook_ENTITY_TYPE_update() for 'field_instance_config'.
*/
function views_field_instance_config_update(FieldInstanceConfigInterface $field_instance) {
// @todo: Is this necessary? Use cache tags to only delete Views' cache data?
\Drupal::cache('data')->deleteAll();
\Drupal::cache('discovery')->deleteAll();
\Drupal::cache('render')->deleteAll();
}
......@@ -537,7 +545,7 @@ function views_field_instance_config_update(FieldInstanceConfigInterface $field_
*/
function views_field_instance_config_delete(FieldInstanceConfigInterface $field_instance) {
// @todo: Is this necessary? Use cache tags to only delete Views' cache data?
\Drupal::cache('data')->deleteAll();
\Drupal::cache('discovery')->deleteAll();
\Drupal::cache('render')->deleteAll();
}
......@@ -547,7 +555,7 @@ function views_field_instance_config_delete(FieldInstanceConfigInterface $field_
function views_invalidate_cache() {
// Clear Views' info cache entries.
// @todo: Use cache tags?
\Drupal::cache('data')->deleteAll();
\Drupal::cache('discovery')->deleteAll();
// Clear the page and block cache.
Cache::deleteTags(array('content' => TRUE));
......
services:
plugin.manager.views.access:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [access, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [access, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.area:
class: Drupal\views\Plugin\ViewsHandlerManager
arguments: [area, '@container.namespaces', '@views.views_data', '@cache.data', '@language_manager', '@module_handler']
arguments: [area, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.argument:
class: Drupal\views\Plugin\ViewsHandlerManager
arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.data', '@language_manager', '@module_handler']
arguments: [argument, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.argument_default:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [argument_default, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [argument_default, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.argument_validator:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [argument_validator, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [argument_validator, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.cache:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [cache, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [cache, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.display_extender:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [display_extender, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [display_extender, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.display:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [display, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [display, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.exposed_form:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [exposed_form, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [exposed_form, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.field:
class: Drupal\views\Plugin\ViewsHandlerManager
arguments: [field, '@container.namespaces', '@views.views_data', '@cache.data', '@language_manager', '@module_handler']
arguments: [field, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.filter:
class: Drupal\views\Plugin\ViewsHandlerManager
arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.data', '@language_manager', '@module_handler']
arguments: [filter, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.join:
class: Drupal\views\Plugin\ViewsHandlerManager
arguments: [join, '@container.namespaces', '@views.views_data', '@cache.data', '@language_manager', '@module_handler']
arguments: [join, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.pager:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [pager, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [pager, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.query:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [query, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [query, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.relationship:
class: Drupal\views\Plugin\ViewsHandlerManager
arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.data', '@language_manager', '@module_handler']
arguments: [relationship, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.row:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [row, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [row, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.sort:
class: Drupal\views\Plugin\ViewsHandlerManager
arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.data', '@language_manager', '@module_handler']
arguments: [sort, '@container.namespaces', '@views.views_data', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.style:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [style, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [style, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
plugin.manager.views.wizard:
class: Drupal\views\Plugin\ViewsPluginManager
arguments: [wizard, '@container.namespaces', '@cache.data', '@language_manager', '@module_handler']
arguments: [wizard, '@container.namespaces', '@cache.discovery', '@language_manager', '@module_handler']
views.views_data:
class: Drupal\views\ViewsData
arguments: ['@cache.data', '@config.factory', '@module_handler', '@language_manager']
arguments: ['@cache.discovery', '@config.factory', '@module_handler', '@language_manager']
views.views_data_helper:
class: Drupal\views\ViewsDataHelper
arguments: ['@views.views_data']
......
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