[wp-hackers] Caching as part of the core
mike at newclarity.net
Tue Jul 24 00:35:30 UTC 2012
On Jul 23, 2012, at 2:25 PM, Michael Van Winkle wrote:
> In my experience caching is done best when it's done by the site developer.
It's be interested in hearing about your experience and the specific scenarios where caching is better done by the site developer?
> One-size fits all solutions tend to fail or create more issues than then
> they solve.
I don't think anyone is arguing for a one-size-fits-all solution. Asking for API support is effectively the opposite approach.
> There are a few places in WP where'd I would like to be able to
> filter the output so I can deliver a cached version. For example in the
> load_template() function it would be nice to have the ability to return a
> "fragment" from the object cache rather than reloading the template file.
Strongly agree. Have you added a trac ticket to request this?
Or we could just use my ticket, which would allow the same thing but was provided for a different use-case:
> However, I'm not sure I understand why the existing object cache is
> insufficient for delivering that fragment. Can we get more specific about
> what the failure of the current object caching api is?
It's not (necessarily) insufficient, it's just a low-level solution for which higher-level APIs could be built on.
An good analogy would be a database system like MySQL is to a file system like those found in Linux just as higher level caching APIs such as for page, query, fragment, widget and menu caching could be to the Wordpress object cache API; i.e the former are built using the latter.
> I think a MUCH bigger issue is theme/plugin developers generally lack of
> awareness and/or concern for caching and performance.
Adding a set of caching APIs so bloggers could write about it would go a long way to providing the requested awareness.
As is, core simply has too many issues to enable good caching implementations in plugins such as the "there-can-be-only-one" dropins problem and sivel's Trac ticket asking for hooks to support fragment caching (this ticket has seen very little attention):
Maybe we could start by discussing what could be changed in core to better support fragment caching?
More information about the wp-hackers