Skip to content
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

Support removing cache keys by pattern #401

Merged
merged 3 commits into from
Oct 20, 2022

Conversation

xsoheilalizadeh
Copy link
Contributor

@xsoheilalizadeh xsoheilalizadeh commented Sep 15, 2022

Fixes #399

Only Memcached is not supported among the providers, if you have any ideas on how we can implement it I'd like to hear them.

@catcherwong catcherwong self-requested a review September 15, 2022 09:57
@catcherwong
Copy link
Member

Only Memcached is not supported among the providers, if you have any ideas on how we can implement it I'd like to hear them.

I don't have a good idea about Memcached as well. NotSupportedException is fine.

@xsoheilalizadeh
Copy link
Contributor Author

Hi @catcherwong, did you have time to look into the PR?

@catcherwong
Copy link
Member

@xsoheilalizadeh In the last review, I pointed out some problems, you should fix them. 😄

@xsoheilalizadeh
Copy link
Contributor Author

Thanks @catcherwong, I addressed the requested changes.

P.S: I am not sure which last review you mean because I didn't receive any reviews until 2 days ago.

Copy link
Member

@catcherwong catcherwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@catcherwong catcherwong merged commit c2ccc4a into dotnetcore:dev Oct 20, 2022
@timschwallie
Copy link

timschwallie commented Jan 31, 2023

For memcached would probably need to maintain a key of keys, aka allKeys.
Then on pattern removal, grab all the keys and run through them for pattern match.
At the same time, you may need to implement a locking mechanism.
allKeys would be a hotspot.
So might need to spread it out into multiple 'allkeys' based on some logic, like key.
Parallel.ForEach might be a way to speed it up using multiple threads.
Keys in 'allKeys' may not exist because of evictions.
Might be able to eek out some performance by adding a field holding the Fixed expiration date.
Have Fixed expiration date populated it that's the policy in use and check it.

To make it consistent, you would need to move this pattern to the other Caches.
Slows things down a touch on create, logical removals, etc.

Note, this does begin to lead into being able to support dependent Keys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove cache keys with key pattern
3 participants