[jboss-dev-forums] [Design of JBossCache] - Re: JBoss Cache Public API
genman
do-not-reply at jboss.com
Wed Jun 4 20:41:17 EDT 2008
Removing type parameters seems like a good idea.
Something to consider would be to change the Node interface to return live references, e.g. "Cache.getNode(x).getData()" would return a Map whose operations affect the in-cache state. So a "getData().clear()" would clear the node data. I'm not sure how well this would work. It may be poorly performing.
I created a "Caches" utility/factory object a long time ago that created java.util.Map instances backed by JBoss Cache and it'd be interesting if something like that were endorsed.
I would suggest changing the CacheLoader interface.
Remove these methods:
| Object put(Fqn name, Object key, Object value) throws Exception;
| Object remove(Fqn fqn, Object key) throws Exception;
|
These are low-performing operations on many CacheLoaders implementations.
Also I would remove
| void put(Fqn name, Map<Object, Object> attributes) throws Exception;
|
and replace the put operation with:
| void replaceAll(Fqn name, Map<Object, Object> attributes) throws Exception;
|
Remove methods that are redundant:
| void loadEntireState(ObjectOutputStream os) throws Exception;
| void storeEntireState(ObjectInputStream is) throws Exception;
|
(Though their removal is probably not critical.)
Also, I'd take a look at how Hibernate uses JBoss Cache 2. It seems there's a bunch of "util" methods that might make sense to carry over. One thing that comes to mind is the use case of storing a single item in a Node. Maybe create a "key" singleton object?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4155838#4155838
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4155838
More information about the jboss-dev-forums
mailing list