[jboss-user] [JBoss Cache: Core Edition] - True Structure of Cache Node?

atifoxon do-not-reply at jboss.com
Tue Mar 31 11:06:57 EDT 2009


I need some explanation of the structure of the Node interface. Below are some excerpt from documentation

>From Interface Node<K,V> Documentation
A Node is a named logical grouping of data in the JBoss Cache. A node should be used to contain data for a single data record, for example information about a particular person or account.

>From Interface Interface Cache<K,V> Documentation
 // creates with default settings and starts the cache
  | 
  | Cache cache = DefaultCacheFactory.getInstance().createCache();
  | Fqn personRecords = Fqn.fromString("/org/mycompany/personRecords");
  |  
  | 
  | Node rootNode = cache.getRoot();
  | Node personRecordsNode = rootNode.addChild(personRecords);
  | 
  | // now add some person records. Fqn peterGriffin = Fqn.fromString("/peterGriffin"); 
  | 
  | // the addChild() API uses relative Fqns 
  | Node peter = personRecordsNode.addChild(peterGriffin);
  | 
  | peter.put("name", "Peter Griffin");
  | peter.put("ageGroup", "MidLifeCrisis"); peter.put("homicidal", Boolean.FALSE);
  | 

Correct me if I have misunderstood it

[1] According to above two a node should contain data related to one record of database
[2] If 1 is correct then each node should store data in from of colName, colValue pair

Is above scheme recommended one or I can use it other way around ? e.g.

[A] I am storing a record in individual nodes as a object against PK of that record and not in colName, colValue fashion. so my cache contains one node per record and each node's map contains only one value which is the record VO (value object). I think I am wasting the maps associated with nodes by doing this. What is your opinion?

[B] If I store set of records at node rather than one record (not correct according to API docs), so my cache contains one node per table. I think this way I am utilizing the node's map. What is your opinion?

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

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



More information about the jboss-user mailing list