[wp-hackers] Caching as part of the core

John Blackbourn johnbillion+wp at gmail.com
Sun Jul 22 00:56:04 UTC 2012

On 22 July 2012 00:57, Brian Layman <wp-hackers at thecodecave.com> wrote:
> You asked about "an object cache" as opposed to "the object cache".  So I'm
> not sure what you call an object cache.  You would implement fragment
> caching using a "persistent cache" and I think that's what you were asking
> about.

My point really was that fragment caching is very straight forward
using either the Transients API, the Object Cache API with a
persistent cache, or both. Example:

if ( !$my_html = get_transient( 'my_html' ) ) {
  $my_html = 'Hello';
  set_transient( 'my_html', $my_html );
echo $my_html;

If there were a fragment caching API, the only difference in this bit
of code would be the name of the functions used to retrieve and store
the fragment. Bear in mind that if you're using a persistent object
cache (eg. APC) then the Transients API just acts as a wrapper to the
Object Cache API.

To rephrase my question, what might a fragment cache API do that the
Object Cache API / Transients API don't do?

More information about the wp-hackers mailing list