Page caching is a method to reduce server-side computations when serving websites.
Modern content management systems (CMS) like WordPress and others use a powerful mix of dynamic code and database storage to create web pages sent as HTML content (+assets) to people’s browsers.
When a page is requested by a browser, server-side code like PHP is executed, and the page’s content is queried from the database, typically MySQL. The content is put in form using a theme design, and the final result is HTML code sent back to the browser.
This process is computationally expensive, and if the site has more visitors, these visits induce more computations to serve more pages. This can quickly become taxing on the server’s resources.
Fortunately, content pages don’t change that frequently, so it is possible to store the previously computed HTML ( = to cache) and serve it the next time a visitor requests the page. When we say page caching, we refer to storing the page’s HTML code for later use.
The cached items need to be purged and re-computed later when the site’s editors make some changes. Every caching system also has an expiry time limit of the cached items. It is called a Time To Live or TTL.
There are many ways to cache pages, including on-disk, in-memory, or even outside the server on a content delivery network (CDN). Depending on your budget, requirements, and technical expertise, each method has pros and cons.
In conclusion, page caching is a way to use some storage space to store HTML pages in exchange for reduced server CPU and memory consumption. It is very efficient, and we recommend always using some form of page caching when possible.
If you understand the basic page caching principles, you can use the most appropriate method for YOUR situation.