BenjaminAdams / wp-redis-cache

Cache Wordpress faster
157 stars 37 forks source link

Wrong benchmark #1

Closed nvartolomei closed 9 years ago

nvartolomei commented 11 years ago

Hello,

looks like you missed the point of WP Super Cache, probably W3 Total Cache too.

You try to compare 0.3s used to generate a page with your 0.009 used just to fetch cached page from redis.

For all 3 systems WP generated the same page ~ in the same amount of time, but when WP Super Cache serves the page it still displays original time it took for WP to generate the page, so it takes 0s to generate page and serves it right away from disk (probably disk cache), while your implementation still involves running php and querying redis.

I hope you understood.

Also what the hell is this?

// If the cache does not exist lets display the user the normal page without cache, and then fetch a new cache page
$html_of_page = @file_get_contents($current_url);

Take a look at WP Super Cache source code and at ob_start function.

BenjaminAdams commented 11 years ago

Oh yeah you're right. I just checked it out in my test site.

$html_of_page = @file_get_contents($current_url);

This is where it fetches the html of the page so we can cache it

nvartolomei commented 11 years ago

You understand what it takes twice amount of time generating a page to do this? As i said, also overhead for network transfer. Take a look at ob_start function. You can buffer content WP is generating and store it in redis.

BenjaminAdams commented 11 years ago

This was to prevent logged in users caching as someone logged in, but I think I can check for the cookie and prevent logged in users from caching that way. Thanks for your help and suggestions.