🐛 Redis does not invalidate cached search results #599
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR fixes the issue regarding cached search results not invalidating in the redis server by reimplementing the caching code in
search
function and replacing the deprecatedset_ex
function withset_options
function.Why is this change important?
This change is essential because it fixes the issue regarding cache invalidation in redis server which if not dealt properly can cause cached results to never get invalidated and very old results to be provided to the users which can really provide a bad user experience.
How to test this PR locally?
It can be tested by installing and running Websurfx as mentioned in the
docs
and on thereadme
and by launching the browser and thoroughly testing. By checking one of the cached search results's ttl by requesting the same search query a couple of times. This can be done by running the following commands:Connect a redis debugging client to the current server:
Fetch one of the cached search result:
Key *
Checking the cached search result's ttl:
Author's checklist
search
function.set_ex
function withset_options
function.v1.17.20
.Related issues
Closes #592