How WordPress Cache Works?
To access and display any articles or post of your WordPress site through a web browser, the WordPress has to shuttle a lot of data around between different computers through internet, and usually over long distance. Your WordPress hosting provider and the hosting server could be in the West, and your site visitors could be from anywhere in the East.
When a site visitor make an access request, your WordPress web server compiles relative data into a HTML page and delivers to the visitor’s computer. And most of the time, your WordPress installation separates into different servers and machines. It is quite often in today’s world, some web pages and files stored on a web server, most of your site data and objects however hosted in databases on different servers. When a HTTP request accepted, your WordPress contacts the database server to fetch posts and other stored data.
WordPress caching is to reuse data from previous requests to speed up subsequent requests. You will find out that your site visitors may access the same web page several times in each session and many site data are actually shared among different visits to various pages. For example, most WordPress site would have a huge banner image, after the initial visit, the visitor’s browser will store a copy of the image on her local hard drive, so when she click to browse another blog post with that banner image, her browser will not try to download the same image file again, instead the local copy stored on her computer will be retrieved. Only after the WordPress site owner make changes to the banner image on the server or the visitor has cleared her browser cache locally, will the web browser download a new copy of the banner image from remote server to her local computer.
In short, WordPress cache is used to minimize the amount of data that must flow between machines across the Internet. This results in fewer requests between machines, and thus your WordPress can load faster. In fact, WordPress caching is the fastest way to speed up your blogs and improve the site performance.
In the example above, it is the caching happens on the client side. The actual WordPress cache could be more complicate. Various types of objects can be cached on both the client (Web browser) and the server (WordPress hosting).
WordPress Cache on Client Side
Your WordPress site can establish caching rules for its content to use the client-side cache. When cache controls are properly set on images and scripts, a Web browser will ask the server if the content has changed since it was last downloaded. These caching rules for WordPress can greatly reduce your WordPress site bandwidth usage and server loading time. Unless your site has been changed, the browser will pull up its locally cached copy, instead of retrieving the entire item from remote servers far away.
WordPress Cache on Server Side
WordPress is usually hosted on Apache servers. Your WordPress hosting service provider will configure their Apache server for more efficient WordPress caching to save bandwidth and improve web site performance.
WordPress cache on the server side can store different types of data and objects, like HTML pages, mssql database query results, images files, multimedia objects and so on.
WordPress cache on the server side could be store in the hard disk or speed media (typically SRAM or RAM) on the server for more efficient retrieval. By storing frequently used objects closer to your users through browser, proxy, or server caches, you avoid round trips to the origin server, reducing bandwidth consumption, server load, and most importantly, latency. However, most WordPress sites that are hosted on a shared server will need to use disk caching other than memory caching.