1 Reply Latest reply on Oct 24, 2013 7:53 AM by Galder Zamarreño

    How do I configure caches using CDI and JCache?

    Martin Ekermo Newbie



      I would like to use the JCache (JSR107) api and interceptors but with Infinispan as a provider. Can't really figure out how I'm suppose to configure caches (expiry time, clustering, etc) when using the interceptors however.

      In my code I have a method like:


      @CacheResult(cacheName = "myCache")

      public String someMethodCall(final String someParam) {



      How do I configure the cache "myCache"?


      I've tried to use the example code from the carmart example and have a producer like:



          public Configuration myCache() {

             return ...


      But this is not used, the cache gets created with default configuration. Is this due to different classloaders being used? Anyone got any examples or hints on how to solve this?



        • 1. Re: How do I configure caches using CDI and JCache?
          Galder Zamarreño Master

          Hi Martin,


          Can you share the example, as you've modified it, with us so that we can inspect it? Maybe put it on GitHub?


          Also, what version of Infinispan are basing on?


          Unfortunately we do not yet have an example that fully matches what you're trying to achieve. We have tests that verify that cache values are injected when using Infinispan caches, but we have not yet produced examples based on JCache.


          Still, I'd like to run your example to debug it further.