[jboss-user] [JBoss Cache: Core Edition] - How I store objects in the cache. Trivial-not trivial?

beep_beep do-not-reply at jboss.com
Mon May 26 07:24:42 EDT 2008


Hi.

This is probably a stupid question, but what can I do? I have that stupid problem... 

suppose we have 2 classes:
1)
package com.a;
  | class A{
  |      int x;
  |      List<B> b;
  | 
  | }
2)
package com.a;
  | class B{
  | 
  |      
  | 
  | }


In short A is parent for collection of B.
A is also multiplied(collection) in DB.


Consider I produce a node, that created to hold objects of type A:

 Node rootNode = cache.getRoot();
  |  Fqn testEntityFqn = Fqn.fromString("/com/a/A");
  |  Node  testEntity = rootNode.addChild(testEntityFqn);
 
 I put then A objects in this node:

 testEntity.put(id, objectA);

 
Fine.

But I ask myself and YOU:
1. Why I've chosen to create separate node for collection of A?
2. Why not separate node for each A in collection?
3. Why not separate node for each A and separate node for each A primitive attribute(int x)?
4. When I need cache B(that under A), what is my considerations: should I create separate node for each B, or one node for collection of Bs?

5.Is there some guide line to HOW we store complex structures in the cache?
6. If object A changed and I have eviction enabled in cluster, is it explicitly invalidates also Bs, that under that A? If B changed, does it cause invalidation of A? In what case it may happen?


Thank you!!!





  










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

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



More information about the jboss-user mailing list