Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-1263

Type safe selection of cache used by the JCache interceptors

    Details

    • Type: Feature Request
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: CDI
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                kevinpollet Kévin Pollet
                Reporter:
                kevinpollet Kévin Pollet
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: