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#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...