4 Replies Latest reply on Apr 26, 2016 6:38 PM by Juan Gabriel Vargas Bolaños

    Unexpected behaviour of infinispan local cache in Wildfly 10.

    Rastislav Vlcko Newbie

      Hi friends,

      this is my first post here and I must say I am looking forward to be member of this forum

       

      So, what is the problem I am trying to solve? I am struggling with the configuration of the infinispan local cache. Especially with the configuration of "max-entries". In the previous version of Wildfly, the "max-entries" was doing exactly what I have expected - it was not possible to enter more entries than max-entries value. On the other hand, in the WF 10 it seems that is is possible. At least with the configuration I have in the standalone.xml

       

      <cache-container name="myCacheContainer">
          <local-cache name="myCache">
              <eviction strategy="LRU" max-entries="2"/>
              <expiration lifespan="600000"/>
          </local-cache>
      </cache-container>
      

       

      My testing scenario was that I was accessing instance of MyCache to add value to the cache using some REST endpoint. Then I was using another REST endpoint to display the content of MyCache. In the previous version of Wildfly, I was able to add exactly 2 entries. Adding third one caused the first one to be replaced. In Wildfly 10, the number of entries keeps growing like if there is no limit for it.

       

      The way I am using the cache in code is pretty standard. Here is MyCache class:

       

      @ManagedBean
      @Singleton
      @Named("myCache")
      public class MyCache implements IMyCache<String, String> {
      
        @Resource(lookup = "java:jboss/infinispan/container/myCacheContainer")
        protected EmbeddedCacheManager container;
        private Cache<String, String> cache;
      
        @PostConstruct
        @Override
        public void init() {
          this.cache = container.getCache("myCache");
        }
          ...
       }
      

       

      MyCache class is then injected to the class with REST resources where it is a part of some business logic.

       

      I would appreciate any suggestions or hints how to fix this.

      Thanks