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

Thomas Hofmann do-not-reply at jboss.com
Fri Nov 16 02:45:42 EST 2012


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

"Re: Using ExpirationAlgorithm in EvictionConfig not working in JBoss 5.1"

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

--------------------------------------------------------------
Sorry, missed some lines in the code. Here is the complete code:

*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<EvictionRegionConfig> ercs = new ArrayList<EvictionRegionConfig>();*
*ercs.add(erc);*
*evictionConfig.setEvictionRegionConfigs(ercs);*
*evictionConfig.setWakeupInterval(500);*
*expirationCache.getConfiguration().setEvictionConfig(evictionConfig);*
*Node cacheNode = rootNode.getChild(cacheFqn);*
*Long future = new Long(System.currentTimeMillis() + 10000);*
*Fqn keyFqn = Fqn.fromElements(key);*
*cacheNode.addChild(keyFqn).put(ExpirationAlgorithmConfig.EXPIRATION_KEY, future);*
*cacheNode.getChild(keyFqn).put("key_1", "value_1");*

*Object value = rootNode.getChild(cacheFqn).getChild(Fqn.fromElements("key_1)).get("key_1");*

Would be very appreciate for any hint, which will do that stuff work!!
--------------------------------------------------------------

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

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/20121116/72b000f0/attachment.html 


More information about the jboss-user mailing list