Closed (duplicate)
Project:
Drupal core
Version:
main
Component:
base system
Priority:
Normal
Category:
Plan
Assigned:
Unassigned
Reporter:
Created:
21 Mar 2024 at 18:18 UTC
Updated:
30 Jan 2026 at 12:41 UTC
Jump to comment: Most recent
Some services are declared with lazy: true and have a proxy class to instantiate them on demand.
For example, the plugin.cache_clearer service is lazy but it is always accessed directly from the container as follows:
\Drupal::service('plugin.cache_clearer')->clearCachedDefinitions();
The returned service is a lazy proxy to the real service, but calling clearCachedDefinitions() immediately negates any benefit of using the lazy proxy.
Remove lazy: true and associated proxy classes from services that do not need to be lazy.
Use modern Symfony features such as tagged service iterators where they would be useful.
Identify which services this applies to.
Comments
Comment #2
longwaveIn fact let's make this a meta as we have some child issues already.
Comment #3
longwaveComment #5
longwaveClosing as dupe of #3514491: [meta] Replace lazy service proxy generation with service closures which has more activity.