Support 'unless' expression for cache veto
Allow @Cachable, @CachePut and equivalent XML configuration to provide
a SpEL expression that can be used to veto putting an item into the
cache. Unlike 'condition' the 'unless' parameter is evaluated after
the method has been called and can therefore reference the #result.
For example:
@Cacheable(value="book",
condition="#name.length < 32",
unless="#result.hardback")
This commit also allows #result to be referenced from @CacheEvict
expressions as long as 'beforeInvocation' is false.
Issue: SPR-8871
This commit is contained in:
1
src/dist/changelog.txt
vendored
1
src/dist/changelog.txt
vendored
@@ -11,6 +11,7 @@ Changes in version 3.2.2 (2013-03-07)
|
||||
* DefaultMessageListenerContainer logs recovery failures at error level and exposes "isRecovering()" method (SPR-10230)
|
||||
* MediaType throws dedicated InvalidMediaTypeException instead of generic IllegalArgumentException (SPR-10226)
|
||||
* consistent use of LinkedHashMaps and independent getAttributeNames Enumeration in Servlet/Portlet mocks (SPR-10224)
|
||||
* support 'unless' expression for cache veto (SPR-8871)
|
||||
|
||||
|
||||
Changes in version 3.2.1 (2013-01-24)
|
||||
|
||||
Reference in New Issue
Block a user