On Tue, 31 Dec 2002, Colin Chalmers wrote: > What's the difference between this and Stratum > which is also a caching mechanism, I believe.
I was previously unfamiliar with Stratum. From the overview it appears similar but I'm actually having trouble finding the basic accessory methods in the Stratum javadocs. Cache essentially like a map, with a "put" method: boolean store(Serializable key, Serializable val); and a "get" method: Serializable retrieve(Serializable key); I think maybe cache is similar to JCS (<http://jakarta.apache.org/turbine/jcs/>), although it looks like JCS currently only works in client/server mode, and cache currently only works "in-process". I think JSR-107 is a bit much for most my uses. For that matter, I've recently found myself simply using Collection's LRUMap in places where I once would have used cache. I do think it would be nice if we had a single library that could scale well in both directions--perhaps by scaling JCS down or cache up. I think I can explain the way cache is set up pretty succinctly. The real driving principle is to apply the strategy pattern to create a modular system that scales from very simple applications to potentially complex ones: * There's a basic Cache interface with Map-like methods to store and retrieve objects, to check if an object is cached, and to clear one or more objects from the cache. * This Cache functionality is implemented by pluggable strategy interfaces: * Stash - for physical storage (in memory, to disk, in a db, etc.) * EvictionPolicy - for determining which objects to evict when the cache begins to fill up (LRU, LFU, LRV, etc) * StashPolicy - for determining which objects are worthy of "stashing" in the first place (optional, typically cost or size based I assume) * There's a JSP taglib for working with this in a JSP (see <http://cvs.apache.org/viewcvs.cgi/*checkout*/jakarta-commons-sandbox/cache/docs/tagext.html?rev=1.1.1.1&content-type=text/html>) * There's also an incomplete client/server extension (org.apache.commons.cache.remote) that should probably be re-implemented > For what kind of apps could I use this for? > WebBased getting info from a DB? Yes, for example. Also JSP or servlet output, the results of an XSLT (or other) transform, data from remote servers, data from files, etc. Really any time you're happy to trade memory (or disk space) for time. Personally I've used it GUI and web service apps in addition to web-based stuff. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
