10 Replies Latest reply on Jun 19, 2015 3:06 AM by Diana Jordan

    Cache eviction & expiration config has no effect on 7.1.0.CR1b

    Rok Bertoncelj Newbie

      I've created a test application that uses 2 caches with similar configuration - only names and means by which they are configured are different. One is configured in standalone.xml and the other is created programatically. The catch is that the frist one (configured in infinispan subsystem) does not honor eviction and expiration policies. No entries are ever removed - I can keep on putting stuff in the cache until OutOfMemoryError occures. The second cache that is configured programatically works fine - entries are removed after configured idle time or when max-entries is reached.


      Am I missing something or is this a bug in JBoss's configuration/integration of infinispan?



      This is how the first cache "cars-cache" is configured:


      <cache-container name="iskratest" default-cache="cars-cache">
          <local-cache name="cars-cache">
              <eviction strategy="FIFO" max-entries="10"/>
              <expiration lifespan="10000" interval="1000" max-idle="5000"/>



      This is a bean where the second cache is created. Also both caches are made available trough CDI to the rest of the application.

      public class CacheFactory {
          @Resource(lookup = "java:jboss/infinispan/iskratest")
          private EmbeddedCacheManager container;
          public Cache getCarsCache() {
              return container.getCache();
          public Cache getCars2Cache() {
              container.defineConfiguration("cars2", new Configuration().fluent()
              return container.getCache("cars2");