"Just-in-time invalidation" gives best
performance and is simplest to implement. Just imagine
what would happen if you tried to implement realtime
invalidation of a cache with thousands of items, each
with varying expiration criteria... the expiration
management would probably drain more resources than the
actual data being cached!
Implementing a *simple* determistic invalidation
mechanism should be fairly simple - just spawn a thread
which periodically accesses the cache object to
remove/refresh items.
And GL!
Addy - I agree. I do think that there should be an API
that allows this, as well as how it works now. Let me
decide if I want to sacrifice performance in specific
cases.
Or you can always write your own to do what you want
instead of crying that you have to do a little work...