[jboss-user] [JBoss Cache] - Using ExpirationAlgorithm in EvictionConfig not working in JBoss 5.1

Thomas Hofmann do-not-reply at jboss.com
Thu Nov 15 09:28:18 EST 2012


Thomas Hofmann [https://community.jboss.org/people/temenosthofmann] created the discussion

"Using ExpirationAlgorithm in EvictionConfig not working in JBoss 5.1"

To view the discussion, visit: https://community.jboss.org/message/776685#776685

--------------------------------------------------------------
I'm using JBoss Cache Malagueta 3.2.5.GA in JBoss 5.1. There is a cache configuration without any eviction config:




The eviction is configured dynamically, and following entries are put into the cache: Key_1=value_1, Key_2=value_2,Key_3=value_3


CacheManager cacheManager = com.bspartners.util.ServiceLocator.getCacheManager();
Cache expirationCache = cacheManager.getCache("prodb-expiration-cache", true);

Node rootNode = expirationCache.getRoot();
Fqn cacheFqn = Fqn.fromString("/OTTO");
Region region = expirationCache.getRegion(cacheFqn, true);
ExpirationAlgorithmConfig expirationAlgorithmConfig = new ExpirationAlgorithmConfig();
expirationAlgorithmConfig.setExpirationKeyName(ExpirationAlgorithmConfig.EXPIRATION_KEY);
EvictionRegionConfig erc = new EvictionRegionConfig(cacheFqn, expirationAlgorithmConfig);
region.setEvictionRegionConfig(erc);
EvictionConfig evictionConfig = new EvictionConfig();
List should be evicted because value is expired!
Object value = rootNode.getChild(cacheFqn).getChild(Fqn.fromElements("key_1)).get("key_1");


After getting the value for key "key_1" after 15 seconds there is the value in the cache. The expiration or the eviction respectively did not start.

The RegionManager in JBoss web-console dumps the region. Why is evitionQueueSize 0?

Region RegionImpl{fqn=/OTTO; classloader=null; status=ACTIVE; eviction=true; evictionQueueSize=0}


Dumping the cache in JBoss web-console lists

--- Cache1 ---
/  null
  /OTTO  null
    /key_2  {expiration=1352982716472, key_2=value_2}
    /key_0  {expiration=1352982716472, key_0=value_0}
    /key_1  {expiration=1352982716472, key_1=value_1}

-
-----------
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/776685#776685]

Start a new discussion in JBoss Cache at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121115/fc4bc5db/attachment-0001.html 


More information about the jboss-user mailing list