Saving your Server with WordPress Internal Cache

Caching is a very important skill for you to obtain when building websites that may receive a lot of traffic at any given time. When using WordPress, you have a very good opportunity to get into some heavy duty caching action so that you can save your server a little bit of work.

The Why.
Just a low level explanation of exactly what happens when your web server displays a page to a visitor. When the visitor comes to your site and page is requested, the WordPress application requests, from your database system, the information that relates to the corresponding post(s). The issue therein lies that normally, every single visitor to your site requires your server to query the database and grab the text to display. As you can imagine, this can quickly get very expensive as far as your server's resources are concerned. This is why caching can really save you. Through caching, your site content will be stored in a "flat file" on your server. This will eliminate the need for your database server to be queried with every single page view.

The How.
To get started, goto your WordPress files and /wp-config.php in your favorite text editor. In this file, you'll see all of the current configuration settings for your database connection.

Add the following line to the end of all that (it really doesn't matter where this code is, as long as it lives in the wp-config.php file):

define('ENABLE_CACHE', true); // cache setting, true means on

Once you've saved that file, go ahead and upload to your server, overwriting the previous file.

Now you have turned on caching! But before you get blogging again, there's one more thing to do.

What we need to do next is create a place for these cached "flat files" to live on your server.

The default location for your cached files is in the directory on your server /wp-content/cache. If that folder is not there, then create it and name it appropriately. Also, you need to double check that the server has permission to write to this directory. In order to do so, you will need to CHMOD the folder to a setting of '777'.

And there you have it! That's how simple it is to use the caching functionality of WordPress.

If you're more technically advanced and would like to learn more about what you can do to your server to speed up your blog, check out this excellent article entitled 4+1 Ways To Speed Up WordPress With Caching

Related Posts

  • WordPress 2.2 Released!
  • Using PHP Headers to Force Download
  • Remove Fancy Quotes in WordPress
  • Ryboe Tag Cloud 1.02 Released
  • Hiding Subpages (Children Pages) in WordPress
  • Leave a Reply