[wp-hackers] WP-Cache vs. eAccelerator vs. Memcache vs. ... (Yeah, another server opt. discussion)

Viper007Bond viper at viper007bond.com
Sun Oct 28 19:56:52 GMT 2007


Okay, so assume I get all the plugins I have installed to be queryless and
using the internal object cache -- would it be as fast as WP-Cache? The
pages are still being generated from scratch rather than just pulled from a
file cache (which is actually cached to memory). It seems like it'd be a
step backwards.

Plus, I already have WP-Cache working just fine (abeit modified quite a bit
to get it working how I want -- gzip + proper dynamic includes), so is it
worth ditching it?

On 10/28/07, Computer Guru <computerguru at neosmart.net> wrote:
>
> The actual engine doesn't make a difference - it'll only cache the
> compiled
> php, and not the results from the database.
>
> the WP plugins let WP store the results from the DB in the opcode engine.
> I
> found it exteremely easy to hack Brian's Latest Comments to use object
> cache
> (no more 33 extra queries per page!) to store all comments and have it
> rebuild the cache when a comment is added.
>
> WP-Cache converts everything to HTML. With object caching + my/ryan/mark's
> plugin, a file "opts-in" to the caching process. Basically, you store the
> results of a query/calculation in the cache, and add a hook to invalidate
> that cache when needed. It's quite easy:
>
> Original line:
>
> $commenters = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(comment_date)
> AS
> unixdate FROM $tablecomments
> WHERE comment_approved = '1'
> AND comment_post_ID = '".$post->comment_post_ID."'
> $ping
> ORDER BY comment_date DESC
> LIMIT $num_comments;");
>
> New line:
>
> // BEGIN WP-CACHE CHECK
> if ( ( !$commenters = wp_cache_get( 'commenters_' .
> $post->comment_post_ID,
> 'blc' ) ) || $invalidated ) {
>
>
> $commenters = $wpdb->get_results("SELECT *, UNIX_TIMESTAMP(comment_date)
> AS
> unixdate FROM $tablecomments
> WHERE comment_approved = '1'
> AND comment_post_ID = '".$post->comment_post_ID."'
> $ping
> ORDER BY comment_date DESC
> LIMIT $num_comments;");
>
>
> wp_cache_add( 'commenters_' . $post->comment_post_ID, $commenters, 'blc'
> );
> }
>
> and
>
> add_action( 'comment_post', 'blc_clear_cache' );
>
> So you basically check if a cache exists by a unique name. if it doesn't
> store results of sql cache to the cache. add a hook to invalidate the
> cache
> when action XXXX is performed.
>
> Almost all of WP core uses object cache and properly invalidates it, so no
> worries there. Any plugins that don't explicitly use object cache will
> display dynamic data. Plugins configured to use object cache will properly
> invalidate data. So no disadvantages to using it (plus, object cache code
> gracefully degrades if object cache is not enabled).
>
> You have to actively "use" the object cache, unlike wp-cache where
> everything is cached. However it's really easy
>
> On 10/28/07, Ozh <ozh at planetozh.com> wrote:
> >
> > How do such plugins (xcache, ea, memcache) behave regarding dynamic
> > parts within files?  To say the least, WP-Cache support for dynamic
> > stuff is terribly frustrating...
> >
> > Ozh
> >
> > --
> > http://FrenchFragFactory.net ~ Daily Quake News
> > http://planetOzh.com ~ Blog and WordPress Stuff
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
>
>
>
> --
> Computer Guru
> Director,
> NeoSmart Technologies
> http://neosmart.net/blog/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Viper007Bond | http://www.viper007bond.com/


More information about the wp-hackers mailing list