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

Allow for a more flexible @CacheEvict annotation [SPR-8629] #13272

Closed
spring-issuemaster opened this issue Aug 22, 2011 · 2 comments
Closed

Allow for a more flexible @CacheEvict annotation [SPR-8629] #13272

spring-issuemaster opened this issue Aug 22, 2011 · 2 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Aug 22, 2011

Travis Schneeberger opened SPR-8629 and commented

It is pretty common in our application to have several related caches that all must be flushed at the same time. We would like to be able to do something like:

class FooService {
@CacheEvictCol {
@CacheEvict(value="foos" key="#f.id"),
@CacheEvict(value="associatesOfFoo" allEntries=true),
@CacheEvict(value="anotherCache" key="'Foo.id=' + #f.id")
}
void updateFoo(foo f);
}

Right now you can specify multiple cache names on the @CacheEvict annotation but those caches must all be using the same key or you would need to use allEntries=true. A a result of this inflexibility, we would probably end up using allEntries=true much more than we would like which would negate some of the benefits of caching.


Affects: 3.1 M2

1 votes, 2 watchers

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Nov 9, 2011

Costin Leau commented

This has been addressed in master by introducing the @CacheDefinitions annotation (we're still looking for a shorter name).
One can declare multiple @Cacheable, @CacheEvict and @CachePut annotations.

Let us know how it works for you!

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 10, 2012

Eric Westfall commented

To help any future generations who might stumble upon this jira, it looks like this annotation was renamed to just @Caching prior to the final 3.1 release.

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.