For the next beta of JBoss Cache 2.0.0, I've taken the public APIs a step further by
genericising them.
This is in CVS right now. Feedback on this new, genericised API is much appreciated.
Affected classes/interfaces are: Cache, CacheSPI, Node, NodeSPI, Fqn, CacheFactory.
My reasoning behind genericising has been that while a lot of people would still want a
cache that holds generic Objects, certain degree of control as to the type can be useful.
For example, enforcing the elements that make up an Fqn or what objects can be used as
keys.
One of the issues here is that if you decide to specify what you want in your cache (keys
and values) you'd need to specify this when creating the cache using the cache
factory, and these types are then used whenever Nodes are created.
Typical usage pattern:
|
| // example where we want all keys to be integers and all the objects in the cache are
Strings.
| CacheFactory<Integer, String> cf = DefaultCacheFactory.getInstance();
| Cache<Integer, String> cache = cf.createCache();
|
| Fqn<String> myFqn = Fqn.fromString("/a/b/c");
| Node<Integer, String> node = cache.getRoot().getChild(myFqn);
|
| node.put(33, "Hello world");
|
Does this relative inflexibility mean that most people would just create Cache<Object,
Object> anyway?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027284#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...