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

Enhancement: Split the @Cacheable annotation into multiple annotations #89

Open
GoogleCodeExporter opened this issue Mar 30, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

I'm working on adding per-request caching in my application. It looks like I 
can do this using the resolverFactory argument for @Cacheable.

However, this appears inflexible as I will have to make the same change to all 
@Cacheable entries that I want on a per-request basis:

@Cacheable(cacheName = "valuationCalendar", 
resolverFactory=@ResolverFactory(name = 
"ch.hedgesphere.core.ehcache.RequestScopeCacheResolverFactory"))

...

@Cacheable(cacheName = "positions", resolverFactory=@ResolverFactory(name = 
"ch.hedgesphere.core.ehcache.RequestScopeCacheResolverFactory"))

If the @ResolverFactory annotation was split out:

@ResolverFactory("ch.hedgesphere.core.ehcache.RequestScopeCacheResolverFactory")
@Cacheable(cacheName = "valuationCalendar")

I could then wrap the @ResolverFactory in another annotation:

@Retention(RUNTIME)
@Target( { METHOD })
@ResolverFactory("ch.hedgesphere.core.ehcache.RequestScopeCacheResolverFactory")
public @interface RequestScopedCache {}

Which leads to the cleaner declaration of:

@RequestScopedCache
@Cacheable(cacheName = "valuationCalendar")

Original issue reported on code.google.com by [email protected] on 1 Nov 2011 at 2:33

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

No branches or pull requests

1 participant