Cache pollution issue when switching between query parameters #17
Labels
bug
Something isn't working
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
invalid
This doesn't seem right
Description
We are encountering an issue in our "filterable" Laravel package where cached results are incorrectly mixed between different query parameters. Specifically, after switching back to a previously made query, the cached results include data from both the current and previous queries.
Steps To Reproduce
/booking?status=pending
. The correct, status-pending bookings are returned./booking?status=completed
. The correct, status-completed bookings are returned./booking?status=pending
.Expected Result: Only bookings with 'pending' status should be returned.
Actual Result: Bookings with both 'pending' and 'completed' statuses are returned, indicating a caching issue where the cache does not differentiate sufficiently between different queries.
Proposed Solution
Enhance Cache Key Generation
Modify the
buildCacheKey()
function to include all relevant query parameters in the cache key generation. This would ensure that each unique set of parameters has its own cache entry, preventing cache pollution.The text was updated successfully, but these errors were encountered: