Allow @CachePut 'key' SpEL to refer to #result

Allow the @CachePut 'key' SpEL to refer to the result of the method call
via a '#result' variable.

This change is particularly useful when working with JPA entities that
have generated @Id values since the ID will often not be available
until the entity has been saved.

Issue: SPR-10664
This commit is contained in:
Phillip Webb
2013-06-23 08:51:51 -07:00
parent f75d4e13a2
commit eea230f2a8
11 changed files with 188 additions and 15 deletions

View File

@@ -45,6 +45,7 @@
<cache:cache-evict method="multiConditionalCacheAndEvict" cache="secondary"/>
<cache:cache-put method="multiUpdate" cache="primary"/>
<cache:cache-put method="multiUpdate" cache="secondary"/>
<cache:cache-put method="putRefersToResult" cache="primary" key="#result.id"/>
</cache:caching>
</cache:advice>
@@ -82,6 +83,7 @@
<cache:cache-evict method="multiConditionalCacheAndEvict" cache="secondary"/>
<cache:cache-put method="multiUpdate" cache="primary"/>
<cache:cache-put method="multiUpdate" cache="secondary"/>
<cache:cache-put method="putRefersToResult" cache="primary" key="#result.id"/>
</cache:caching>
</cache:advice>