[wp-hackers] Caching as part of the core
otto at ottodestruct.com
Tue Jul 24 18:38:38 UTC 2012
On Tue, Jul 24, 2012 at 1:09 PM, Mike Schinkel <mike at newclarity.net> wrote:
>> What are you trying to implement into this dropin that would need transients?
> Page caching could use transients, and pages can be the result of composition of fragments.
Page caching would indeed use the advanced-cache.php drop-in.
WP-Super-cache does exactly that. Using transients there would be
highly difficult, however I'm not sure that you'd want to,
realistically. Transients are essentially wrappers around database or
object cache calls. Storage of whole-page caching methods is capable
of being done more directly, and much faster, without the overhead
transients and the object cache bring to the table. Either you store
the page cache in a way that bypasses the need for PHP to execute at
all (super-cache) or you store the page directly in an external memory
system, where the WP_Object_Cache overhead is not helpful to you.
Fragment caching makes no sense in advanced-cache.php. The problem
with fragment caching is as the ticket states, the lack of reasonable
hooks to buffer and store output of various templates or pieces of a
page. I'm not personally convinced by the effectiveness of fragment
caching, it strikes me as a case of premature optimization for *most*
cases, although I can see it being useful for edge cases if you also
conduct profiling to determine where the load really is. Even so,
you're going to want to implement caching around only the fragments
causing the load, not all of them, and regardless you'd virtually
never want to store them in transients. Transient pulls are slower
than, for example, widget output, for the majority of cases. If you
wanted to cache the header or the sidebar as a single piece, then
going on to store it in the database (for the default case) is a bit
of a waste of time. Databases are often the major bottleneck on the
majority of hosting.
Re: Multiple-dropins, I both agree and disagree, in that I agree
drop-ins are hacky as heck, but I disagree that there is a vast need
for multiple-support for them. Most of them are for specific purposes
such that only one thing would ever be needed there. No site is going
to have two drop-ins for external object caching, which is the only
thing that you'd use that for. Like it says in the code itself:
// For an advanced caching plugin to use. Uses a static drop-in
because you would only want one.
More information about the wp-hackers