Details
-
Enhancement
-
Resolution: Obsolete
-
Minor
-
None
-
None
-
None
Description
Currently the name of the cache which will be used by the JCache interceptors has to be specified in JCache annotations (e.g. @CacheResult(cacheName="greeting-cache")).
This can be error prone (typo, refactoring ...). The CDI integration module provides the possibility to associate a qualifier to a cache. This qualifier could be re-used to provide a type safe selection of the cache used by a JCache interceptor. Something like:
public class GreetingService { @CacheResult @GreetingCache public String greet(String name) { return "Hello" + name; } }
Here we need to be in sync with JCache specification. In my understanding of the spec the cache name is required for @CacheRemoveEntry and @CacheRemoveAll (but currently in the API there is a default value initialized to blank). For @CacheResult if no cache name is defined a default one is used.