Whitelist-Based Cache Key Handling for URL Parameters
Currently, Shopware allows excluding certain URL parameters from the cache key to save storage. However, this exclusion list keeps growing, making maintenance cumbersome. Instead of excluding parameters, a whitelist approach could offer more control and efficiency.
Analysis:
I tracked URL parameters in a default Shopware installation—from listing to PDP, filtering, and placing an order. These 19 parameters were captured (more possible):
cluster, keys, language, limit, locale, manufacturer, max-price, min-price, no-aggregations, order, orderId, p, paid, properties, rating, redirected, slots, timezone, search
Instead of maintaining an ever-growing exclusion list, switching to an allowlist approach would ensure that only essential parameters impact the cache key.
Proposed Solution:
- Allowlist Configuration – Define a clear set of parameters that should be part of the cache key instead of excluding specific ones.
- Event for developers – Introduce an event to allow developers to modify the allowlist dynamically.
- Control by config – Provide a config option to adjust the allowlist as needed.
This approach simplifies maintenance, optimizes cache storage, and ensures that only relevant parameters affect cache variations. 🚀
