From: Gavin_King/Cirrus%<CI...@ci...> - 2002-02-27 04:23:28
|
Quite a few people seem to want hibernate to be able to cache data. I'm not convinced that people need this feature as much as they think they do; nevertheless, there is at least three cases where its useful * application has exclusive access to database * static data * non-critical data that is "almost" static (ie. a timeout cache is apropriate) I have added a feature request for this. It's not at all difficult to implement - we would just have RelationalDatabaseSession.load() check a cache on ClassPersister after checking its own internal cache. Then there would be a couple of places where we would need to add, replace or remove objects. William Grosso, writing in onjava.com has described a good cache expiration algorithm ("hashbelt"). Unfortunately his implementation uses a seperate thread to do expiration + uses generics, so I'll have to adapt it. There would need to be two kinds of cache: 1. A cache for readonly data where sessions can share the same object instance. 2. A cache for mutable data - only one session can use the cached instance. Unless anyone else is keen to implement this, I'll probably get onto it in the next couple of days.... PS. Is it spelled "cacheing" or "caching"? |