This project optimizes menu block caching for anonymous users by reducing the number of cache tags used. It does this by assuming anonymous users can access all published content and handles only node links. Users should test this module thoroughly before production use, as it relies on several core assumptions.
By default, menu blocks contain cache tags for each node that the menu links to, so that the menu can be invalidated if access to the node changes. This can result in a lot of cache tags for large menus and frequently invalidate large parts of a site if any of those nodes is saved.
Warning: This module is a proof of concept and attempts to optimize this by making several assumptions, it also depends on the following core issue #3485030: Avoid saving menu links through node form when they do not change, which means Drupal 11.5+ or 12.0 is required:
- Caching is only optimized for anonymous users
- It is assumed that anonymous users can access all published content and can not access unpublished content.
- Only node links and cache tags are supported and invalidated
- It does not only support menu_link_content links as it uses the menu tree storage API, but will only find routed node links.
Do not use this on production without extensive testing. If any of those assumptions are not true for your site, menu links will either remain visible when they are inaccessible or not become visible when they should. It will not make the linked pages accessible or not.
Future iterations will add the ability to customize those assumptions with alternative strategies.
Ask your assistant about Menu cache optimizations
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
Activity
Releases
| Version | Type | Core | PHP | Release date | |
|---|---|---|---|---|---|
| 1.x-dev | Dev | 9–11 | Jan 10, 2025 |