Hi Craig

From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
> I'm trying to clarify in my mind the differences between a "cache" as you
> scratched out in pseudo-code and an object pool (in the sense of the
> current Commons "pool" package) -- or even a generic implementation of
> java.util.Map that does fancy stuff behind the scenes.  Could you help me
> by articulating what some of the differences are?

Sure. Sorry if I dived in a bit quick there (was very busy yesterday).

The main difference is with pooling you remove an object then put it back
again. With a cache you just look it up via some key but keep it in there
for others to use. So caching is more useful for looking up 'read only'
objects or 'singletons'.

I'm particularly interested in (say) caching of XSLT stylesheets, read only
dom4j Document instances, database or web service query results and such
like. Pooling is more applicable to things like database, socket or
messaging midddleware connections and such like.

What I'd like to have / build / use is a simple facade over (say) Map
implementations.  (You can call me James 'Facade' Strachan from now on if
you like ;-)

Just like log4j and logkit are facades over 'loggers', things that write to
some log somewhere, I'd like the cache project to be a facade over 'some
cache data structure' that uses some configurable policy to determine
staleness, how much to cache etc.

The Map implementations we've already got in the collections project (along
with maybe the others from Turbine that Daniel mentioned) will probably do
as much of the implementation for now. Some other internal plumbing could
well be useful (such as an optional background thread to purge stale objects
in all cache instances, pluggable purging / caching / invalidation policies.
Maybe plug in messaging for implementing simple distributed caches etc.

James


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to