- Issue created by @berdir
- 🇨🇭Switzerland berdir Switzerland
I think there's actually one more lookup for each last write timestamp, the cache tag IIRC is for invalidateAll() which is almost never used, and there is a separate delete flag that's not a tag.
- 🇨🇭Switzerland berdir Switzerland
Cross-reference: 📌 Deprecate CacheBackendInterface::invalidateAll() Active .
- 🇨🇭Switzerland berdir Switzerland
Created a merge requests, seems to be working pretty well.
- 🇨🇭Switzerland berdir Switzerland
Tested this a bit more, have to clean the returned cache tags so they aren't picked up by the fast chained backend:
Impact of this as a diff of the MONITOR output:
--- compare/monitor_before.txt 2025-01-18 13:48:27.451401512 +0100 +++ compare/monitor_after.txt 2025-01-18 13:49:58.731385550 +0100 @@ -1,12 +1,8 @@ "HGETALL" "core:container:service_container:prod:11.2-dev::Linux:a:4:{i:0;s:40:\"/var/www/html/sites/default/services.yml\";i:1;s:44:\"/var/www/html/sites/develop "GET" "core:cachetags:x-redis-bin:container" "GET" "core:container:_redis_last_delete_all" -"HGETALL" "core:config:last_write_timestamp_cache_config" -"GET" "core:cachetags:x-redis-bin:config" -"GET" "core:config:_redis_last_delete_all" -"HGETALL" "core:discovery:last_write_timestamp_cache_discovery" -"GET" "core:cachetags:x-redis-bin:discovery" -"GET" "core:discovery:_redis_last_delete_all" +"GET" "core:last_write_timestamp_cache_config" +"GET" "core:last_write_timestamp_cache_discovery" "HGETALL" "core:access_policy:access_policies:drupal:[user.is_super_user]=1:[user.roles]=authenticated,administrator" "GET" "core:cachetags:x-redis-bin:access_policy" "GET" "core:access_policy:_redis_last_delete_all" @@ -15,9 +11,7 @@ "HGETALL" "core:data:route:[language]=en:[query_parameters]=:/" "MGET" "core:cachetags:route_match" "core:cachetags:x-redis-bin:data" "GET" "core:data:_redis_last_delete_all" -"HGETALL" "core:bootstrap:last_write_timestamp_cache_bootstrap" -"GET" "core:cachetags:x-redis-bin:bootstrap" -"GET" "core:bootstrap:_redis_last_delete_all" +"GET" "core:last_write_timestamp_cache_bootstrap"
This saves 3x2 GET commands for the config, discovery and bootstrap cache bins during bootstrap roughly up until dynamic page cache.
Complete output after with this:
"HGETALL" "core:container:service_container:prod:11.2-dev::Linux:a:4:{i:0;s:40:\"/var/www/html/sites/default/services.yml\";i:1;s:44:\"/var/www/html/sites/develop "GET" "core:cachetags:x-redis-bin:container" "GET" "core:container:_redis_last_delete_all" "GET" "core:last_write_timestamp_cache_config" "GET" "core:last_write_timestamp_cache_discovery" "HGETALL" "core:access_policy:access_policies:drupal:[user.is_super_user]=1:[user.roles]=authenticated,administrator" "GET" "core:cachetags:x-redis-bin:access_policy" "GET" "core:access_policy:_redis_last_delete_all" "HGETALL" "core:access_policy:access_policies:drupal:[languages:language_interface]=en:[user.is_super_user]=1:[user.roles]=authenticated,administrator" "MGET" "core:cachetags:config:user.role.authenticated" "core:cachetags:config:user.role.administrator" "core:cachetags:access_policies" "HGETALL" "core:data:route:[language]=en:[query_parameters]=:/" "MGET" "core:cachetags:route_match" "core:cachetags:x-redis-bin:data" "GET" "core:data:_redis_last_delete_all" "GET" "core:last_write_timestamp_cache_bootstrap"
There are still 2 cache tag lookups for the bin-tag that powers invalidateAll(), on container and access_policy. I'll create a separate issue to allow to opt-out of the current invalidateAll() implementation and handle it as a deleteAll().
I also want to investigate the access policy implementation.
- 🇨🇭Switzerland berdir Switzerland
Merged. Next step: 🐛 Allow to remove support for invalidateAll() and treat it as deleteAll() Active
Automatically closed - issue fixed for 2 weeks with no activity.