title: Infinispan-specific configuration when used as JCache (JSR-107) provider?
body: <p>Our Thorntail (2.4.0.Final) webapp is using Infinispan as a <a href="https://infinispan.org/docs/stable/user_guide/user_guide.html#jcache_jsr_107" rel="nofollow noreferrer">JCache (JSR-107) provider</a>. We would like to modify Infinispan specific attributes (such as default acquire timeout) in addition to JCache's attributes (such as store-by-value option).</p>
  
  <p>Our current solution isn't working. Here's what we've tried so far.</p>
  
  <ul>
  <li>Defined <code>infinispan.xml</code>:</li>
  </ul>
  
  <pre><code>&lt;infinispan
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="urn:infinispan:config:5.2 http://www.infinispan.org/schemas/infinispan-config-9.4.xsd"
          xmlns="urn:infinispan:config:9.4"&gt;
  
      &lt;cache-container&gt;
          &lt;local-cache  name="foo"&gt;
              &lt;locking acquire-timeout="15000"/&gt;
          &lt;/local-cache&gt;
      &lt;/cache-container&gt;
  &lt;/infinispan&gt;
  </code></pre>
  
  <ul>
  <li>The config above is then used by the following class:</li>
  </ul>
  
  <pre><code>public class CacheManagerProducer {
  
      @Produces
      @ApplicationScoped
      public CacheManager defaultEmbeddedCacheManager() {
          return Caching.getCachingProvider().getCacheManager(URI.create("infinispan.xml"), this.getClass().getClassLoader());
      }
  }
  </code></pre>
  
  <ul>
  <li><code>FooCache</code> interface is defined as:</li>
  </ul>
  
  <pre><code>@Qualifier
  @Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.METHOD})
  @Retention(RetentionPolicy.RUNTIME)
  
  @Documented
  public @interface FooCache {
  }
  </code></pre>
  
  <ul>
  <li>Here's how we're configuring cache using JCache API:</li>
  </ul>
  
  <pre><code>@Produces
  @FooCache
  public Cache&lt;Long, DiscountOrAddition&gt; createDiscoCache(InjectionPoint injectionPoint) {
      MutableConfiguration&lt;Long, DiscountOrAddition&gt; config = new MutableConfiguration&lt;&gt;();
      config.setStoreByValue(true);
      config.setStatisticsEnabled(false);
      config.setManagementEnabled(false);
      return mgr.createCache("foo", config);
  }
  </code></pre>
  
  <p>This is where we fail as <code>foo</code> cache already exists (created as per XML config). Is there a way we could configure existing cache? Or any other alternative way allowing us to stay cache-provider agnostic? Thank you for your answers.</p>