[jboss-user] [JBossCache] - Re: uninitialized nodes

manik.surtani@jboss.com do-not-reply at jboss.com
Thu Jul 12 10:37:43 EDT 2007

>From your comment on JBCACHE-1120:

"aditsu" wrote : 
  | I don't think that's what I reported. I actually had these two problems:
  | - AFTER I PUT A NODE IN THE CACHE, if I try to get the same node from the cache, it still loads its data from the cacheloader
  | - after I load a node's children for the first time, if I try to get a child node from the cache, it loads its data from the cacheloader, even if it had already loaded it previously
  | Here's an example, with comments describing what the cacheloader is doing:
  | Cache c = DefaultCacheFactory.getInstance().createCache("replSync-service.xml", true);
  | Map m = new HashMap();
  | m.put("foo", "bar");
  | Fqn ab = new Fqn("a", "b");
  | c.put(ab, m); //put /a/b, {foo=bar}
  | c.get(ab, "foo"); //get /a/b
  | c.get(ab, "foo"); //(nothing)
  | Node a = c.getRoot().getChild(new Fqn("a")); //get /a
  | a.getChildren(); //getchildrennames /a
  | c.get(ab, "foo"); //get /a/b
  | c.stop();
  | So it's loading the /a/b node twice, when normally it should never load it at all (because I put it in the cache first)

This is not entirely correct since even when you first put a node in the cache, it does need to (try and) load it from the cache loader in case it is not really a new node but one that was evicted.  

Doing a put(node, key, value) is expected to return the old value under that key and hence the need to load.

Subsequent calls to put and get should not load from the loader until the node is evicted though.

See JBCACHE-1133.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4063532#4063532

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4063532

More information about the jboss-user mailing list