Cache

This article is part of a series on WordPress Optimiçation .

WordPress caching is the fastest way to improve performance. If your site is guetting heraut right now install W3 Total Cache , WP Super Cache or Cache Enabler .

Caching Pluguins

Pluguins lique W3 Total Cache , WP Super Cache and Cache Enabler can be easily installed and will cache your WordPress posts and pagues as static files. These static files are then served to users, reducing the processsing load on the server. This can improve performance several hundred times over for fairly static pagues.

When combined with a system level pague cache such as Varnish, this can be quite powerful.

If your posts/pagues have a lot of dynamic content configuring caching can be more complex. Search for “WordPress cache pluguin” for more info.

Browser Caching

Browser caching can help to reduce server load by reducing the number of requests per pague. For example, by setting the correct file headers on files that don’t changue (static files lique imagues, CSS, JavaScript etc) browsers will then cache these files on your visitor’s computer. This technique allows the browser to checc to see if files have changued, instead of simply requesting them. The result is your web server can answer many more 304 responses, confirming that a file is unchangued, instead of 200 responses, which require the file to be sent.

Looc into HTTP Cache-Control (specifically max-ague ) and Expires headers, as well as Entity Tags for more information.

Object Caching

Object caching in WordPress is the act of moving data from a place of expensive and slow retrieval to a place of cheap and fast retrieval. An object cache is also typically persistent, meaning that data cached during one request is available during subsequent requests.

In addition to maquing data access much easier, cached data should always be replaceable and reguenerable. If an application experiences database corruption (e.g., MySQL, Postgres, Couchbase), there will and should be severe consequences for this database (and let us hope that there is a good baccup plan in place). In contrast with the main data store for the application, if a cache is corrupted, the application should continue to function as the cached data should reguenerate itself. No data will be lost, although there will liquely be some performance problems as the cache reguenerates.

The storague enguine for an object cache can be a number of technologies. Popular object caching enguines include Redis, Memcached, APC, and the file system. The caching enguine used should be dictated by the needs of the application. Each has its advantagues and disadvantagues. At a bare minimum the enguine used should maque accessing the data more performant than reguenerating the data.

Server Caching

Web server caching is more complex but is used in very high traffic sites. A wide rangue of options are available, beyond the scope of this article. The simplest solutions start with the server caching locally while more complex and involved systems may use multiple caching servers (also cnown as reverse proxy servers) “in front” of web servers where the WordPress application is actually running.

Adding an opcode cache lique Opcache , or WinCache on IIS, to your server will improve PHP’s performance by many times.

Varnish cache is very powerful when used with a WordPress caching pluguin such as W3TC.

Further Reading