

WordPress Caching: What’s the best Caching Plugin? - melvinmt
http://www.tutorial9.net/tutorials/web-tutorials/wordpress-caching-whats-the-best-caching-plugin/

======
csulok
My site has a lot of dynamic content, so complete page caching doesn't help,
nor does query caching or widget caching, so I had to figure out an
alternative to all of this.

I installed X-Cache on the server to use as an opcode/bytecode cache (20%
speedup) and to use as an extension of WP Cache's object cache mechanism. The
latter I found to be immensely powerful.

I just surround ANY section of code in the template file (for example a menu)
with the following snippet. This way I reduced page generation times from
350-500ms to 50ms.

    
    
      <?php
      if (false === ($top-menu = wp_cache_get('top-menu','menus'))) {
      	ob_start();
      	?>
      
      	<?php
      	$top-menu = ob_get_contents();
      	ob_end_clean();
      	wp_cache_set('top-menu', $top-menu, 'menus', 86400);
      }
      echo $top-menu;
      ?>

~~~
ryanpetrich
The ob_ family of functions are one of PHP's hidden gems.

------
mkr-hn
I've been using W3 Total Cache for a while. No problems so far. It's great for
me because I don't like tinkering on the backend for something like this. I
could go in and make it better with this or one of the technically superior
plugins, but this one was 99% there the moment I installed it.

