barbara b [http://community.jboss.org/people/barbaraboie] created the discussion
"cache NULL when clicking on a button" To view the discussion, visit: http://community.jboss.org/message/579791#579791 -------------------------------------------------------------- Hello Before I used a previous version of JBoss Cache where I simply could use in every bean: @In(create=true)CacheProvider cacheProvider public void method(){ ... List) cacheProvider.get("tree-"+id); if (rubriek == null){ cacheProvider.put("tree-"+id,getTree()); } ... } and the caching worked just fine through the whole site. Now I'm trying to work with JBoss Cache 3.2.5.GA and it's not working. Every time I click on a button, the cache is empty. What I did were these steps: I started changing the code in each bean into CacheFactory factory = new DefaultCacheFactory();Cache cache = factory.createCache("cache-configuration.xml"); public void method(){ ... List) cache.get(fqn,"tree"); if (rubriek == null){ cache.put(fqn,"tree",getTree()); } ...} When I tried this code, I saw that the cache was each time emptied when I hit a button. I thought I could come because I start in each bean a new Cache by using +factory.createCache("cache-configuration.xml")+ So I made a new class that can be used in every bean and so that the cache is only started once public class CacheHelper{ public static CacheFactory factory = new DefaultCacheFactory(); public static Cache cache = factory.createCache("cache-configuration.xml"); } public void method(){ ... but the cache is still empty each time I hit a button. Is there anyone who can tell me what I'm doing wrong? Thanks in advance! barbara O, and this is my cache-configuration.xml -------------------------------------------------------------- Reply to this message by going to Community [http://community.jboss.org/message/579791#579791] Start a new discussion in JBoss Cache at Community [http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2052]
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
