[jboss-user] [JBoss Cache: Core Edition] - Re: Do you prefer a tree or a plain map API for your project

genman do-not-reply at jboss.com
Fri Nov 7 01:48:30 EST 2008


I contributed a class that creates a Map style view... not sure it's really that optimized or not. I wrote it since I thought it might integrate better with our own API but nobody here seems to care either way.

Here's the API:
anonymous wrote : 
  | <K, V> Map<K, V> org.jboss.cache.util.Caches.asMap(Node<K, V> node)
  | Returns a Map, where map keys are named children of the given Node, and values are kept under a single key for this node. The map may be safely concurrently modified through this Map or externally, and its contents reflect the cache state and existing data of the Node. This means that ConcurrentModificationException is never thrown and all methods are thread safe. 
  | 
  | The map is not serializable. 
  | 
  | Usage note: As a single node is used for every key, it is most efficient to store data for a single entity (e.g. Person) in a single object. 
  | 
  | Also, when using a CacheLoader for storage, keys used must be valid as part of the Fqn used in calls. Generally speaking, simple string values are preferred.
  | 
  | Parameters:
  | node node in a cache to wrap
  | Returns:
  | a Map representation of the cache
  | 

The problem with the JBoss Cache API (IMHO) is having a Map per node. Having a single Object per node would have worked out almost as well to most end users and would have simplified internal development for the product.


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

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



More information about the jboss-user mailing list