WP-Cache
WordPress Plugins: Sunday, May 20th, 2007
Handle high traffic!
The most recent version of WP-Cache works pretty well. WordPress is pretty quick software and caches access to the MySQL database as it is. But with WP-Cache, pages that are normally created by the server on the fly are written to basically HTML files which can be brought up by future accesses to the same page. This reduces processor and database access load on the server. The main reason you may want to use this or even just activate it as needed is if you get linked by a very high-traffic site.
One problem I have with WP-Cache is that it does not like to work with the Theme Switcher plugin. There is one fix that kind of fixes it. Depending on the browser the person is using it just doesn’t always update when they switch the theme, until at least the next time they reopen their browser software. You need to edit the “wp-cache-phase1.php” file. Find this line:
if (preg_match("/^wordpress|^comment_author_email_/", $key)) {
and replace it with this line:
if (preg_match("/^wordpress|^wptheme|^comment_author_email_/", $key)) {
I run WP-Cache on all my WordPress installs, for my comic that has the Theme Switcher plugin I have it running but disabled, so I could just enable it in the event I got a surge of traffic for some reason.
Also it is good to turn the cache off while working on the template so that the changes are reflected and you are not looking at cached pages.























June 22nd, 2007 at 2:23 pm
Thanks for this tip. Unfortunately it kind of doesnt work for me. It doesn’t matter if I use it or not, Wordpress with wp-cache (latest that is 2.1.1) is kind of scary together with theme-switcher.
When I click on the link like http://my-forum/index.php?wptheme=theme1 and then http://my-forum/index.php?wptheme=theme2 I still see theme1’s frontpage. But when I add anything to the URL like http://my-forum/?whatever theme2 frontpage appears. When I clear the cache, I see theme2 everywhere.
So - it seems to work without doing anything but it doesn’t clear the cache when swicthing.
Anyone knows how to fix this?
June 22nd, 2007 at 3:13 pm
Oh nevermind. No i dea why but it was because I copied and pasted exact line from your blog. When I entered it manually it worked suddenly (no blank screen!) — many thanks for this tip — it saved me some hourse of debugging!
July 10th, 2007 at 3:41 pm
Just a note, if anyone uses Dreamhost, they now auto-install this plugin via their one-click installer for WordPress.
September 25th, 2007 at 9:30 pm
I’m using a List Apart’s 2002 PHP stylesheet switcher in PHP4 (doesn’t work in 5, but I’ll install one this weekend and upgrade PHP).
I have hand coded static files for the bulk of my website with the blog in WordPress custom themed matching my site’s design.
This method works with my configuration in IE6 and 7 (tested). Didn’t work in Firefox 2 or the newest windows versions of Opera and Safari (gave unpredictable results in these two).
So I’m doing what you did, turning it off and will turn it on in the event I get an avalanche of comments.
So come buy, leave yours, and start the trend: blog.
November 20th, 2007 at 7:42 am
Hi there…Thanks for the nice read, keep up the interesting posts..what a nice Tuesday
December 1st, 2007 at 6:33 pm
[...] Scott had the design basically ready to insert into the corresponding areas of the template pages. A little tweaking was needed to adjust the navigation buttons the way he wanted them, as well as removing the extra comments and post information code, as his site runs comment free. The greatest challenge here was switching over a 3000+ archive of comics, and keeping the site running smoothly with the large traffic. The original database was in Textpattern and WordPress’ built in Textpattern importer did most of the work, just needing a few corrections and additions. That’s too many comics to work well for the built-in archive template page ComicPress comes with, but the new PvP site proves that it’s not necessary, instead just relying on the streamlined calendar and monthly archives dropdown, allowing anyone to preview comics through any month or arriving at any date they chose. As far as the traffic, WordPress and the ComicPress theme prove to handle the traffic more speedily than ever, with or without the extra page caching. [...]
February 2nd, 2008 at 3:59 am
I simply got rid of a stylesheet switcher on my <a href=”http://christophdollis.com/”business website, but for my personal site, I finally migrated it from Blogger with a PHP scipt called blogKomm that was was getting SLAMMED with comment spam to WordPress (yay!).
I’m using the WordPress theme switcher plugin on this one and PHP 5.x. I just completed your edit to make theme switcher work with wp-cache. I’ll let you know if there are any problems.
Thanks for all your help!
February 2nd, 2008 at 4:00 am
Link corrected for my business site.
February 2nd, 2008 at 5:03 am
I did run into a problem. That problem is it didn’t work!
I wish it did. Really. But after clicking the stylesheet changed a couple times, it doesn’t switch.
February 9th, 2008 at 9:41 pm
I have been visiting this site a lot lately, so i thought it is a good idea to show my appreciation with a comment.
Thanks,
Jim Mirkalami
PS: I am a single dad.