You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Emmanuel Bourg <e....@cross-systems.com> on 2003/12/02 15:24:29 UTC

[cache] Turning cache into a thin abstraction layer a la logging ?

It seems the cache component in the sandbox is no longer developed, 
however I'm convinced there is a need for a common caching API, at least 
until the JSR 107 is completed. I think the cache component could be 
turned into a thin layer similar to commons logging, abstracting the 
various implementations already available (JCS, OSCache, SwarmCache...).

The JCache project uses this approach (http://jcache.sourceforge.net), 
it tries to implement the first published specifications of the JSR 107, 
but it seems the final specification will be completely different and 
Map based.

For the API I was thinking at :
- a Cache interface extending the java.util.Map interface and adding a 
CacheException on the put, get, remove and clear methods.
- the CacheException would be a runtime exception so that a cache can be 
used as a Map without additional try catch blocks
- an abstract CacheFactory with a static getCache(String region) method 
(and maybe a similar getCache(Class cls) method)
- Cache and Factory implementations for some open source caches (at 
least JCS)
- a simple cache implementation, wrapping the LRUMap from commons 
collections for example
- the component will not be responsible for the configuration of the cache

I'm willing to contribute if it is seen as a step in the right direction.

Emmanuel Bourg