-
Notifications
You must be signed in to change notification settings - Fork 38.5k
@CachePut evaluates key before cache condition #22294
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
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: superseded
An issue that has been superseded by another
Comments
lgxbslgx
added a commit
to lgxbslgx/spring-framework
that referenced
this issue
Apr 8, 2019
@Cacheable, @CacheEvict and @cACHEpUT evaluate their keys after their cache condition which contains the `condition` and `unless`. Add the corresponding test cases. Fixes spring-projects#22294.
+1 |
I've edited your comment to improve the formatting. You might want to check out this Mastering Markdown guide for future reference. |
key
before unless
condition
key
before unless
condition
Closing in favor of PR #22769 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: superseded
An issue that has been superseded by another
Uh oh!
There was an error while loading. Please reload this page.
Affects: Spring Context 4.3.4 and higher
Trying to use
@CachePut
on a method that might returnnull
.You would expect the key expression not to be evaluated if the
unless
condition istrue
but this is not happening. The key is being evaluated before theunless
condition is evaluated which leads to aThe
collectPutRequests
tries to evaluate the key if thecondition
passes (there is no condition). I think the keys need to be evaluated only ifunless
isfalse
?The text was updated successfully, but these errors were encountered: