[keycloak-user] Unexpected behaviour of infinispan local cache in KC 1.9.2

Vlcko Rastislav vlcko.rastislav at scheidt-bachmann.sk
Wed Apr 20 03:37:45 EDT 2016


Hi,

 

I have the following problem. I am struggling with the configuration of the
infinispan local cache. Especially with the configuration of "max-entries".
In the previous version of Keycloak (1.7.0), 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 Keycloak 1.9.2 it seems
that it 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 is following: I have deployed my application to the
Wildfly where the KC is running. In my app 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 KC, I was able to add exactly 2 entries. Adding third one caused
the first one to be replaced. In KC 1.9.2, 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.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160420/8fcf1926/attachment.html 


More information about the keycloak-user mailing list