Aller au contenu principal
Kgaut's links

Navigation principale

  • Accueil
Menu du compte de l'utilisateur
  • Se connecter

Fil d'Ariane

  1. Accueil

New cache prewarm API

Par kgaut , 14 octobre 2025
URL
Access to this page has been denied.
body
Change record status: 
Published (View all published change records)
Project: 
Drupal core
Introduced in branch: 
11.2.x
Introduced in version: 
11.2.0
Issue links: 
#3257725: Add a cache prewarm API
Description: 

A new API has been added for services to tag themselves as prewarmable.

To do this, add the cache_prewarmable service tag, and implement PreWarmableInterface.

Example

    tags:
      - { name: cache_prewarmable }

Plugin managers may also use PreWarmablePluginManagerTrait and several core plugin managers have been adapted to use it.

+  /**
+   * Implements \Drupal\Core\PreWarm\PreWarmableInterface.
+   */
+  public function preWarm(): void {
+    $this->getDefinitions();
+  }

Cache prewarming should not depend on request-specific or request-derived information like the current route, language, or theme, although you could specify these explicitly in a preWarm method as long as persistent and any static caching is accounted for. This is because the context in which a cache can be prewarmed could be prior to routing or via the CLI.

Résumé

A new API has been added for services to tag themselves as prewarmable.

To do this, add the cache_prewarmable service tag, and implement PreWarmableInterface.

Tags

  • Drupal
  • cache

Mots clés

activitypubAndroidAnniversaireAppauvergnebaladebatchcacheCICultureDaronnadeddevdebiandockerDrupalfedorafirefoxgitgithubgitlabgitlab-cigooglehome-assistantjardinagekoboLecturelinuxmigrate APIOrchestrationoutilphpphpunitplexrandonnéesportSpotifysymfonysécuritéTestswallpaper
Propulsé par Drupal