JBoss Community

Using ExpirationAlgorithm in EvictionConfig not working in JBoss 5.1

created by Thomas Hofmann in JBoss Cache - View the full discussion

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

Start a new discussion in JBoss Cache at Community