securitywildflyinfinispaninfinispan-9wildfly-18

infinispan 9 '<eviction strategy="LRU" />' isn't an allowed element


Wildfly 18 eviction tag is not parsing giving Failed to parse configuration error. this is coming when i upgrade Wildfly 11 to 18. In wildfly 11 (infinispan 4) its working fine

    <subsystem xmlns="urn:jboss:domain:infinispan:4.0">
        <cache-container name="security" default-cache="auth-cache">
            <local-cache name="auth-cache">
                <locking acquire-timeout="${infinispan.cache-container.security.auth-cache.locking.acquire-timeout}"/>
                <eviction strategy="LRU" max-entries="${infinispan.cache-container.security.auth-cache.eviction.max-entries}"/>
                <expiration max-idle="-1"/>
            </local-cache>
        </cache-container>
    </subsystem>

In Wildfly 18 having below section (NOT WORKING)

    <subsystem xmlns="urn:jboss:domain:infinispan:9.0">
        <cache-container name="security" default-cache="auth-cache">
            <local-cache name="auth-cache">
                <locking acquire-timeout="${infinispan.cache-container.security.auth-cache.locking.acquire-timeout}"/>
                <eviction strategy="LRU" max-entries="${infinispan.cache-container.security.auth-cache.eviction.max-entries}"/>
                <expiration max-idle="-1"/>
            </local-cache>
        </cache-container>
    </subsystem>

Its giving ^^^^ 'eviction' isn't an allowed element here.infinispan:9.4 its says Eviction is configured by adding the but even that gives unrecognized tag memory.

how to add eviction strategy=LRU or replacement to strategy:"LRU"=?


Solution

  • According to the docs in infinispan 9.0 eviction is configured by adding the <memory/> element to your <*-cache/> configuration sections. Eviction is handled by Caffeine utilizing the TinyLFU algorithm with an additional admission window. This was chosen as provides high hit rate while also requiring low memory overhead. This provides a better hit ratio than LRU while also requiring less memory than LIRS. In general there are two types:

    So I would think you define it like that:

    <cache-container name="security" default-cache="auth-cache">
        <local-cache name="auth-cache">
            <...your other options...>
            <object-memory/>
        </local-cache>
    </cache-container>
    

    OR

    <binary-memory eviction-type="MEMORY/COUNT"/>
    

    OR

    off-heap-memory eviction-type="MEMORY/COUNT"/>
    

    AND you can always specify the size:

    size="${infinispan.cache-container.security.auth-cache.eviction.max-entries}"
    

    Storeage types: