<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
pre
        {mso-style-priority:99;
        mso-style-link:"Predform\00E1tovan\00E9 HTML Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.PredformtovanHTMLChar
        {mso-style-name:"Predform\00E1tovan\00E9 HTML Char";
        mso-style-priority:99;
        mso-style-link:"Predform\00E1tovan\00E9 HTML";
        font-family:"Courier New";
        mso-fareast-language:SK;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=SK link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-US>Hi,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>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<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:SK'><cache-container name="myCacheContainer"> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:SK'> <local-cache name="myCache"> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:SK'> <eviction strategy="LRU" max-entries="2"/> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:SK'> <expiration lifespan="600000"/> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:SK'> </local-cache> <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:10.0pt;font-family:"Courier New";mso-fareast-language:SK'></cache-container><o:p></o:p></span></p><p><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";mso-fareast-language:EN-US'>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.<o:p></o:p></span></p><p><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";mso-fareast-language:EN-US'>The way I am using the cache in code is pretty standard. Here is MyCache class:<o:p></o:p></span></p><pre><code>@ManagedBean <o:p></o:p></code></pre><pre><code>@Singleton <o:p></o:p></code></pre><pre><code>@Named("myCache") <o:p></o:p></code></pre><pre><code>public class MyCache implements IMyCache<String, String> { <o:p></o:p></code></pre><pre><code><o:p> </o:p></code></pre><pre><code> @Resource(lookup = "java:jboss/infinispan/container/myCacheContainer") <o:p></o:p></code></pre><pre><code> protected EmbeddedCacheManager container; <o:p></o:p></code></pre><pre><code> private Cache<String, String> cache; <o:p></o:p></code></pre><pre><code><o:p> </o:p></code></pre><pre><code> @PostConstruct <o:p></o:p></code></pre><pre><code> @Override <o:p></o:p></code></pre><pre><code> public void init() { <o:p></o:p></code></pre><pre><code> this.cache = container.getCache("myCache"); <o:p></o:p></code></pre><pre><code> } <o:p></o:p></code></pre><pre><code> ... <o:p></o:p></code></pre><pre><code>}<o:p></o:p></code></pre><pre><code><o:p> </o:p></code></pre><p class=MsoNormal><span lang=EN-US>MyCache class is then injected to the class with REST resources where it is a part of some business logic.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>I would appreciate any suggestions or hints how to fix this.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks.<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>