-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Efficient Cache Invalidation Strategy #2825
Comments
Right, so: this is a complex topic. Recent Redis builds have HEXPIRE for per-field expiration on hashes, but: SE Redis does not yet support that, and IIRC neither does azure Redis yet (@philon-msft would know more about that). There is no direct way to do what you want here. The |
@mhayward-dev - one approach could be to use RediSearch to search for keys you want to invalidate rather than Scanning over all of your Redis Instances. You'd just store your data in a hash, and have whatever the tag is you want to use for invalidating be a separate field in that tag (the prefix in the case of a scan). Let's just call that
then you'd create your items in Redis, they would have the
Then you can search for your keys using the search syntax:
Then you can just call RediSearch is available currenting in the Enterprise Tier of Azure Cache for Redis, or in all non-flash tiers of Azure Managed Redis which went into public preview about a month ago. All the Search commands are available in NRedisStack - which builds directly on top of SE.Redis. |
Hello, I am new to Redis and trying to improve my understanding so forgive my ignorance.
Problem:
I am seeing many chain SCAN calls in Azure App Insights that hold up the request and looking to find a much more efficient method to find and bulk delete keys with the same prefix.
Example problem:
In this case each SCAN is very fast but we see each scan taking >1ms across regions.
Implementation:
{account123}:attribute1:attribute2
prefix
is{account123}
. We do not expect a high amount of records being returned around 5 - 20.How could I improve this solution to avoid waiting on the SCAN to complete? I am looking at HSET but in this case I need to set an expiry per name/value.
Thanks in advance.
The text was updated successfully, but these errors were encountered: