[nycphp-talk] PHP caching (not opcode)
Tom Melendez
tom at supertom.com
Fri Jul 18 11:42:37 EDT 2008
> I love the idea of providing the cache with an event model, so that
> you can fire events that invalidate the parts of the cache that are
> listening for them. I haven't ever seen that before, but then again I
> don't get out much. Is it derived from some other system/language?
>
> The caches I've used and built are of the stock squid or apc
> variety--they check on load to see if the cache is valid, and recreate
> it if necessary. Call it "pull". What you propose (in part) is "push":
> mark the cache as expired at action time, so that when a subsequent
> request gets around to reading out the cached value it can already be
> regenerated and ready to go.
>
So this is basically the "perfect" cache. Items are cached "forever"
until invalidated. Easier to achieve with data sources that don't
depend on many variables (basically static data coming from a
database, an article, a block, data appropriate for everyone vs. user
specific data) with basically a publish methodology and file cache and
a mechanism to flush. Much more difficult for the variants.
We've done alot of work on this at Y! and unfortunately it is tailored
a little too much to our environment to be useful to others. A lot of
effort went into invalidating not only the file cache but the squid
layers as well, on box CPU usage as well as network performance. A
drop-in technique for the popular frameworks out there would be an
awesome invention.
With anything else, you need to weight whether or not you need it and
if it is worth the overhead of implementing it.
Tom
http://www.liphp.org
More information about the talk
mailing list