Best WordPress Plugins: WP-Cache

By Daniel Scocco

Recently I had some problems with my hosting service (I will not include names because they have been reliable so far) and as a consequence the website was taking a lot of time to load. In order to solve that problem I decided to install the WP-Cache plugin.

WordPress already has a very fast structure so that under normal circumstances you will not need this plugin. WP-Cache becomes useful if your hosting server is slow, if your site has been featured on Digg or if you want to save bandwidth.

The plugin stores your pages on a static file and serves the visitor requests from that file instead of loading the dynamic pages from the database, improving the responsiveness of the site.

The only problem I found through the installation was that it was serving blank HTML pages the first time someone tried to visit them. Once the pages were cached, however, they would appear normally.

In order to solve this problem you need to locate the WP-Cache folder on your server and open a file called “wp-cache-phase2.php”. Once you open the file search for the function “wp_cache_ob_end”, and look for the line “ob_end_clean();” inside that function. Finally just change this line with the following “ob_end_flush();”.



Share

37 Responses to “Best WordPress Plugins: WP-Cache”

  • egon

    My website has been running rather slow as well, and I have considered using WP-Cache. However what I’m afraid of is the dynamic aspects of my site (specifically AdSense, and a sliding javascript menu) ceasing to function correctly. Has anybody had experience with this? I understand you can exclude certain files from being cached, but what about AdSense inside the content?

  • Daniel

    I am not sure how the plugin will affect Adsense. It might cause problems with dynamic plugins like Democracy Polls, but that is the only issue I am aware off.

  • Wendy Piersall :: eMom

    When I first started my blog, this plugin caused me all sorts of headaches because I didn’t understand how it worked. I was working on customizing my template, and going to check the edits on my live pages – but of course, the edits weren’t showing up, because WPCache serves up static pages.

    The workaround I found was to either turn the plugin off when I was making edits, or you can go in and manually delete the html pages in the cache file folder on your server. To turn it off, you need to do that from the WPCache page in the WP admin – NOT by deactivating the plugin.

    Just a little helpful info I thought might prevent future headaches for others. 🙂

  • Daniel

    Wendy, you are right, the cache can be a pain when you are trying to change your blog design.

    Apart from the cache plugin I also had problems with WordPress 2.0 cache, which is integrated on the engine. To turn this one off you need to open the wp-config.php and remove the following line:

    define(‘WP_CACHE’, true);

    Once you are done with the modifications you put it back.

  • Nocturnal

    I would have to say prior to 2.1 my WP install would take often times ages to load, espcially right after writing a post. No matter what I did my host would always tell me it isn’t on their end but rather it was the software. Now that 2.1 has come out, it’s been blazing fast. Thanks for the tip though.

  • Ajay

    About the blank pages, did you turn up GZip from the Wp-Admin > Options ??

  • Ajay

    Btw, to disable the cache temporarily, you can just hit Disable Cache in Options > WP-Cache

  • Ashish Mohta

    WP-Cache is not much helpful if your site is dynamic.However if its partial or static it works like a magic.

    If you have scripts, google ads running around your post, there is a marginal increase in the speed but its still worth it.

    One more thing, if your site gets lot of comments be sure to set the timeout low.Else the comments show up after one hr which is the default timeout for WP-Cache.

  • Daniel

    Ajay, Gzip was fine, so I am not sure why the blank pages were appearing, but the tweak I mentioned solved it perfectly.

    Ashish, good point, the timeout for the cached pages must be regulated to fit the blog.

  • theUg

    What would be really interesting is whether that caching would alleviate DB outages, and PHP install glitches. I shall not mention names as well, but I’ve been plagued by those at my host and I am currently moving.

    If plug-in caches pages in static HTML, then I wouldn’t have a problem, but it wouldn’t work, because to pull page from cache PHP should be on. Maybe it would help only with DB outages.

    And another curiosity — I use WP within K2 framework, which has built-in AJAX features, including live search, commenting, and rolling archives. So I wonder how would cache work with those things.

  • Ashish Mohta

    @theUG:::
    I have not seen the code but it must be able to resolve which page is asked when a url is requested.If cached int should redirect towards the static file and that before sending to php or wp system.It should happen before.

    About the ajax feature, i am not sure but since scripts are stored as such within the html file so it will be still called.Anyways Ajax is fast enough so there is no need of caching it.

  • HandCellPhone

    Hi,
    I am investigating whether Google Adsense was affected by this plugin. I have seen my earning jumps up and jump down in a split of few minutes. I afraid Google might think that your websites will get fraud clicks because of caching.

  • Maski

    Hi everyone,.. yeah im curious about WP-cache and adsense,.. when wpcache reads the page from the DB is also loads the adsense right? well… when another visitor access the same page.. does he gets the same adsense that was cached early or… he get zero adsense-. thanks

  • vijay

    For now I will prefer not to use this plugin..I don’t think there is too much load on my server or server is slow 🙂

  • Jason Lancaster

    The WP-Cache plugin has been nothing but trouble for me. Even worse, most of the support forum posts I find don’t recommend anything constructive — “just uninstall the plugin”.

    The issue is an internal server error, and it has something to do with the .htaccess file. I’ve tried fixing it, but now that I’ve read it doesn’t work with any dynamic content, I’m really wondering why you would recommend it in the first place…

  • Victor Teixeira

    I will just explain one thing: the wpcache plugin caches the php part of web pages transforming it on pure html so the server doesn’t calls the the php functions and the database everytime someone visit your site.

    Since google adsense is not php – it’s javascript – it will still behaving the same way.
    It will not be affected!
    WPcache doesn’t caches javascript!

    Ajax should also work fine since the php is called from javascript and the php is outside the page.

  • J.J.

    Your web host wasn’t necessarily slow, so I’m glad you didn’t name names. I’m a systems administrator for a major hosting provider myself, and have solved hundreds of wordpress issues.

    WordPress is resource-intensive, not fast as you say. It uses PHP and MySQL to generate content, both of which need to be tuned to handle specific types of high traffic. If you’re purchasing your average cheap-ass shared hosting, you’ve got a generic PHP and MySQL configuration by nature, and you’re sharing resources with other sites and services. This isn’t a flaw with your hosting provider, it’s you getting what you’re paying for. You can’t expect a Yugo to drive like a Ferrari.

    WP-cache is a great step forward for WordPress. Other services, like Blogger.com (which I use myself), have been publishing to flat HTML for years. However, it’s important to note that there’s still overhead with wp-cache. There’s still the initial PHP calls running the wp-cache plugin code before the proxy off to the flat content is achieved. And if you have a blog that gets high enough traffic, it’s enough overhead to matter. Sure, you wind up at a fast flat file…but you’re still slowing down with PHP before you get there.

    If you get dugg or stumbledupon or slashdotted for one post, your best performance option is going to be to generate a fully flat HTML copy of that post, and use an apache redirect to send the wordpress URL to that flat file. That pulls PHP and MySQL completely out of the picture, and your post is no simply a matter of http requests.

    If you’ve got a blog that regularly gets heavy traffic, you’re basically going to choose the balance that works best for you. Your best performance will be achieved with CMS software that writes flat content and only uses PHP/MySQL during the administrative and publishing process. But if you’re already invested in wordpress and you enjoy the interface, wp-cache is a good step to take to make it run as fast as it possibly can, you’ll just have to make sure you have the hosting horsepower to keep it going. It’s all balances and choices and stuff.

    If it’s still slow at that point, THEN it’s time to seek a better hosting provider 🙂 I know of one, but I won’t name names… 😉

  • Andrew

    Hi Daniel,

    I hope you can try my new cache plugin WP Widget Cache

    http://wordpress.org/extend/plugins/wp-widget-cache/

    It can cache the output of your blog widgets, like the Categories, Popular Articles, Recent Articles, and significantly reduce you server usuage.

    Regards,
    Andrew

  • Grimmy

    I’m using WP super cache without any problems.
    Before editing your blog, turn it off and turn it back on when you’re done.
    Using it with All in One Adsense and YPN without problems as well without problems.
    Just don’t set it to random, lol.
    Another advantage you can get from using it is when you’re on a VPS or dedicated server and use Lighttpd or Nginx to serve the static files (using it on 2 servers) and let Apache handle the dynamic stuff.
    The serverload drops significantly 😉
    I’m also using Andrews widget cache and that made a big difference as well.

  • Bang Kritikus

    Thanks for your info

  • Doug Williams

    I am using a forum with my site and have set the plugin up to ignore any url string with “forum” in it.

    My problem is I have added a “recent forum topics” to my home page column so people can see the latest topic that has been created to or responded to.

    To get this feature to work properly I must have wp-cache reject the home page which is www. dailynewscaster.com. So if I add this as a rejected string all of my site is not cached.

    There is a place inside the wp-cahce manager that will allow for filenames such as wp-post.php to be cached even if the page it is on is rejected.

    Two questions how do I format the rejected string? I tried /dailynewscaster and does not work yet when I use /forum cache does ignore any url with “forum” in it.

    Second do I just go into themes and take all the php file and add them to wp-cache’s accepted filename area to make sure those element particularly popular website (not forum) posts are cached? For example add wp-post.php to those filenames to be cached even if page is to be ignored?

    Thank you,

    Doug

  • Henrietta

    I am debating whether to use WP-Cache or not. I read that people are having massive problem with Caching plug-in.

    I heard the lastest WP has its own Caching, not sure if I were right.

    Any idea?

    Thanks
    Henrietta

  • Doug

    Hi Henrietta,

    I use wp-cache with no problems if you need a dynamic page like a forum you need to work around that page via the plugin not to hard to do.

    I have heard/read people having issues with wp-superchache but I have never used it so can’t really say.

  • Henrietta

    I downloaded it a few hours ago and it seems to work well 🙂

    Under the Plug-in there are buttons to “delete cache” and “delete files” – do I need to do that from time to time?

    Thanks
    Henrietta

  • Doug

    Yes you will need those buttons. For example if you are updating your site design, graphics or advertising. You will want to delete cache to see the update live on the site without waiting for the cache to expire. You can also choose how long the cache is kept. Play with the plugin you can also choose url’s that are not cached.

  • Bisnis Internet

    Thanks for the info. I have considered to use it. Thankyou!

  • Jason

    Please help! Anyone! wp-cache and i apparently dont get along well at all! Since installing it, it has kept me from getting to certain pages and now will not even allow me to login. I believe I need to delete a line from my wp-config file, problem is I do NOT see that file anywhere. I am using the arthemia template! Please please please help…..i am new to this and have no clue how to get back into my site now!

    Thanks so much!

  • Alan

    I think I may have issues with caching and Adsense. I have been running it for about 2 weeks now and have noticed that my Page impressions are about half of what I would expect. I was just thinking that it was a Google thing (with the bad economy) but I am now thinking that it may be due to the plugin. I am going to run it in half on mode for a few days to confirm.

    Anyone else see this effect?

  • Stacy

    I wish that the people offering the solutions that they found offer a step-by-step instruction on how they fixed their problem, otherwise, its confusing to the people reading these messages.

    Where is this WP-Cache file in Admin? I upgraded to 2.84 from 2.63, and now my site has been hijacked, and I can’t refresh any of the pages. Also, it keeps telling me to “upgrade to 2.84” when I already did. I deleted the files from FTP, and re-did everything. If I delete the wp-admin, etc., I don’t know what will happen to all of the work I did.

    *Sigh*

  • Shahab khan

    If i am not wrong then WP Super Cache and WP cache are two plugins for the same purpose. Which one should be used?

  • Tony

    I cam here trying to decide which caching plugin to use on my blogs, and I am none the wiser unfortunately. One problem with plugins is that there are so many that do more or less the same thing, and it’s really hard to know which is the best.

Comments are closed.