Hack WP-Cache for Huge Speed IncreaseMarch 11th, 2008
« Speed Tips: Add Cache-Control HeadersUpdated robots.txt for WordPress »
If you desire SPEED from your WordPress blog, the #1 speed improvement comes from using the WP-Cache Plugin. However, if you still desire even more speed after installing the Plugin, you can modify the WP-Cache Plugin code run even faster!
WP-Cache Off
WP-Cache Default Settings
WP-Cache With wp-cache-phase1.php Hack
WP-Cache With Full Hack
These results came from the Cacheability Checker. Yslow for firefox is what you need today.
First you should download and activate the WP-Cache Plugin, then enable it in your Options Configuration Panel for WP-Cache.
/* No used to avoid problems with some PHP installations
$content_size += strlen($log);
header("Content-Length: $content_size");
*/
// BEGIN AskApache WP-Cache hack
$content_size += strlen($log);
header("Content-Length: $content_size");
// END AskApache WP-Cache hack
/* Not used because it gives problems with some
* PHP installations
if (!$response{'Content-Length'}) {
// WP does not set content size
$content_size = ob_get_length();
@header("Content-Length: $content_size");
array_push($wp_cache_meta_object->headers, "Content-Length: $content_size");
}
*/
// BEGIN AskApache WP-Cache Hack
if (!$response{'Content-Length'}) {
$content_size = ob_get_length();
@header("Content-Length: $content_size");
array_push($wp_cache_meta_object->headers, "Content-Length: $content_size");
}
// END AskApache WP-Cache Hack
if (!$response{'Content-Type'}) {
$value = "text/html; charset=\\"" . get_settings('blog_charset') . "\\"";
@header("Content-Type: $value");
array_push($wp_cache_meta_object->headers, "Content-Type: $value");
}
// BEGIN AskApache WP-Cache Hack
if (!$response{'Cache-Control'}) {
$value = "max-age=$cache_max_time, public";
@header("Cache-Control: $value");
array_push($wp_cache_meta_object->headers, "Cache-Control: $value");
}
// END AskApache WP-Cache Hack
Just download and install as if it were the actual WP-Cache Plugin.wp-cache.zip | wp-cache.rar
Then check out the other speed articles on AskApache.
Or just add this to your blogs .htaccess file.
# HEADERS and CACHING # 1 YEAR <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "public" Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT" Header unset Pragma Header unset Last-Modified Header unset ETag FileETag None </FilesMatch> # 2 DAYS <FilesMatch "\.(xml|txt)$"> Header set Cache-Control "max-age=172800, public, must-revalidate" Header unset Pragma Header unset Last-Modified Header unset ETag FileETag None </FilesMatch> # 2 HOURS <FilesMatch "\.(html|htm)$"> Header set Cache-Control "max-age=7200, must-revalidate" Header unset Pragma Header unset ETag FileETag None </FilesMatch> # COMPRESSION <FilesMatch "\.(js|css)$"> SetOutputFilter DEFLATE </FilesMatch>
« Speed Tips: Add Cache-Control HeadersUpdated robots.txt for WordPress »
The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. Tim Berners-Lee
It's very simple -
you read the protocol
and write the code.
-Bill Joy
HTML | DCMI | GRDDL | XOXO | XDMP | XFN | DOM | XML | XHTML 1.1 Strict | CSS 2.1 | W3C | WAI | DISA | ICSI | GIAC | SANS RR | GHOST
Authority: 110 ↑ TOPExcept where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed according to these terms. "Apache" is a trademark of The ASF.
Seems the Heade modifications doesnt work on my hosts apache server. too bad.
If I modify the code as describet manual, the pages are shown as source html.
and if i download your version i get this error:
Fatal error: Class ‘CacheMeta’ not found in /www/htdocs/w0098a5f/wp-content/plugins/wp-cache/wp-cache-phase2.php on line 39
I use Wordpress 2.6 and PHP 5. Any time for suggestions how i can check if i can enable header stuff at my provider ?
thank you
How does this work with the speedy cache plugin url=aciddrop.com ?
[...] Hack WP-Cache for maximum speed [...]