Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to avoid JBoss-Cache region from getting evicted?
    primarykey
    data
    text
    <p>I'm trying to create a jboss-cache for data that is only relevant for a short period of time. After that time the data should be discarded and the respective memory freed.</p> <p>The cache is organized like this: </p> <pre><code>/my_region /session_1 /datanode_1 attribute1: value1 /datanode_2 attribute2: value2 /session_2 ... /session_3 ... ... ... </code></pre> <p>And my eviction policy configuration looks like this:</p> <pre><code>&lt;attribute name="EvictionPolicyClass"&gt;org.jboss.cache.eviction.LRUPolicy&lt;/attribute&gt; &lt;attribute name="EvictionPolicyConfig"&gt; &lt;config&gt; &lt;attribute name="wakeUpIntervalSeconds"&gt;5&lt;/attribute&gt; &lt;region name="/my_region"&gt; &lt;attribute name="maxNodes"&gt;100&lt;/attribute&gt; &lt;attribute name="timeToLiveSeconds"&gt;1800&lt;/attribute&gt; &lt;/region&gt; &lt;/config&gt; &lt;/attribute&gt; </code></pre> <p>This works: when <code>/my_region</code> gets more than 100 children, the least recently used children are evicted so that the region shrinks back to 100 children.</p> <p>The problem with the <code>LRUPolicy</code> is that when the evicted nodes have children, <a href="http://community.jboss.org/thread/84264?tstart=0" rel="nofollow noreferrer">they're not completely removed, but marked with <code>jboss:internal:uninitialized: null</code> instead</a>. This behaviour makes sense for entities that are cached to avoid fetching them from a persistent storage, but it is not suitable for caching entities that are not persisted and will never be accessed again.</p> <p>So, to remove the nodes, I've created an extension of <code>LRUPolicy</code> that overrides evict with remove.</p> <pre><code>@Override public void evict(Fqn fqn) throws Exception { cache_.remove(fqn); } </code></pre> <p>This new policy does not leave <code>joss:internal:uninitialized: null</code>'s behind, but it removes the <code>/my_region</code> node when <code>maxNodes</code> is reached. When I put the <code>LRUPolicy</code> back, I noticed that the region node itself actually gets evicted and gets the <code>unitialized</code> tag, but the 100 most recently used children still remain.</p> <p>How can I prevent the region itself from being evicted? Is there some better way to do the removal instead of eviction without separating the <a href="http://markmail.org/message/tstmtsihvd66crwx" rel="nofollow noreferrer">eviction from expiration</a>?</p> <p>I'm using jboss-cache version 1.3.0.SP4.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload