-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Cache programmatic API - invalidate entries whose keys match a predicate #30316
Conversation
✔️ The latest workflow run for the pull request has completed successfully. It should be safe to merge provided you have a look at the other checks in the summary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice improvement, thanks! This could use a new section in the cache doc.
LGTM
Yes, the Caching using the programmatic API could describe all |
@mkouba @gwenneg while I understand the motivation behind this method, for caching servers such as Redis or Infinispan looks like a dangerous idea to me (all the keys need to be read, apply the predicate and then send remove operations). I would like us to consider the idea of deprecating this method in the SPI |
Hm, I don't think we should deprecate the method but instead throw an |
@mkouba sounds like the method was promoted because we had it in the library implementation we were using. I believe this method does not belong in a Caching SPI, but this is not my call |
Well, that depends on how the cache is used. And it's actually not part of an SPI but a part of public user-facing API. |
@mkouba looks like if it is also part of an SPI now, since we need to implement the interface to be used by the interceptors and chose a different cache provider |
but as I said earlier, it's not my call :) |
Currently, you would need to make use of
CaffeineCache
, then iterate over the key set and finally remove an entry if it matches a predicate/condition.