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 steven.d...@gmail.com on 1 Nov 2011 at 2:33
Original issue reported on code.google.com by
steven.d...@gmail.com
on 1 Nov 2011 at 2:33