Posted by brianrepko
on April 2, 2007 at 12:23 PM PDT
The Hibernate group is redesigning their caching package and I (once again) lament the sad state of caching in Java.
I often lament the lack of a standard caching framework in Java. JSR107 is the JSR for it but it was started in like 2001 and the JCACHE API was finally published in 2005. I just looked at it on java.net and it isn't all that great.
I've often longed for a "commons-caching" - a standard client library that could be implemented underneath by the JDK LinkedHashMap, OpenSymphony OSCache, Hibernate ehcache, WhirlyCache(sp?) and I think there are some others (Turbine's JCS??). This is really not hard (and I've done two of those under a common framework for a client).
The Hibernate discussion got me to look at the JCACHE API and frankly it just isn't going to work - there is a clear lack of direction on whether the cache loads on a miss or if the client puts on a miss. I personally favor a cache client API that is a Map and has a property for name (I assume that a Cache is what many cache systems call a Region) and a way back to a CacheFactory. I'm not sure about use of an MBean but that also makes sense to me - a management and monitoring API. DAOs should be able to add a CachingInterceptor as well - which is why I think that the client (the interceptor) should put versus the cache loading on a miss.
This really is something that needs to be done for JDK 7, in my humble opinion. Its gone on long enough (what up Cameron?). Lots of folks are implementing JCACHE since its out there but the JSR needs work.
Anyway, I'm moving from Minneapolis to the UK (West Yorkshire) for a year (wife's expatriate assignment) starting May 1st so I might have time to put this together...stay tuned! Any folks that would want to help - let me know (brian.repko at learnthinkcode.com) or anyone with contract work in West Yorkshire - PLEASE let me know!