Closed
Description
Stéphane Nicoll opened SPR-11316 and commented
#13338 and #15257 have introduced two customisations related to the cache operation: cache manager and key generator.
The feature is tedious and error-prone as these customisations have to be set for each and every operation. The idea here is to introduce a new annotation @CacheConfig
that could be set at class-level only and that would gather those customisations as well as the default cache name. Something like:
@CacheConfig(cacheManager = "myCacheManager")
public class FooRepository {
@Cacheable("test)
public void getFoo(String id) { ... }
}
If a caching operation specifies its own cache manager, key generator or cache names, that one is used instead of the default.
In other words, this is about giving 3 levels of customisation:
- General level (the global "cacheManager", "keyGenerator"; not available for cache names)
- Class level (through the
@CacheConfig
annotation) - Operation level (through the explicit caching operation such as
@Cacheable
)
Issue Links:
- Introduce qualifier in @Cacheable for cache manager name [SPR-8696] #13338 Introduce qualifier in
@Cacheable
for cache manager name - Be able to specify custom key generators on a per-cache basis [SPR-10629] #15257 Be able to specify custom key generators on a per-cache basis
- Apply CacheResolver to Spring's caching abstraction [SPR-11490] #16115 Apply CacheResolver to Spring's caching abstraction
Referenced from: commits 2b89c1a, 3c28301
0 votes, 6 watchers