1 Reply Latest reply on Dec 7, 2017 6:29 AM by sebastian.laskawiec

    Wildfly 10 + Infinispan module + JCache

    anonmoto

      I'm using Wildfly 10.1.0 + Infinispan 8.2.4.Final + cache API 1.0.0 trying to enable Infinispan Jcache Interceptors in my application with minimum efforts, with no programmatic setup if possible.
      I want to make such an annotation work to store some dictionaries:

      @CacheResult(cacheName = "dictionary", cacheKeyGenerator = MyCacheKeyGeneratorImpl.class)
      public List getDictionary() {
         ...
      }


      So I downloaded Infinispan Wilfly/EAP module, unpacked it to Wilfly modules folder and added this to jboss-deployment-structure.xml:

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">

        <deployment>

        <dependencies>

        <module name="org.infinispan" slot="ispn-8.2" services="export"/>

        <module name="org.infinispan.cdi" slot="ispn-8.2" services="export"/>

        <module name="org.infinispan.jcache" slot="ispn-8.2" services="export"/>

        </dependencies>

        </deployment>

      </jboss-deployment-structure>


      Now the annotations are processed and some default cache container is used to create "dictionary" cache. Now I want to fine-tune this cache container.

      What's the common way to inject infinispan configuration? Is it possible to plug the module settings into the main Wilfly configuration file (standalone.xml) to define this cache container like this, or specify them in a separate file?


      <cache-container name="JCacheContainer" default-cache="default" module="org.infinispan.jcache">

        <local-cache name="default">

         <transaction mode="NONE"/>

         <eviction strategy="LRU" max-entries="1000"/>

         <expiration max-idle="3600000"/>

        </local-cache>

        <local-cache name="dictionary">

         <locking acquire-timeout="15000" isolation="REPEATABLE_READ"/>

         <transaction locking="PESSIMISTIC" mode="NONE"/>

         <eviction strategy="LRU" max-entries="100000"/>

         <expiration lifespan="15000" max-idle="15000"/>

        </local-cache>

      </cache-container>


      Any help is very much appreciated.