There are many ready solutions for caching data on php, but I will propose own Cache Php Class. It is quite simple and will help to understand the mechanism of caching.
We will not be caching whole pages, this solution is outdated. In reality, only caching of individual blocks is used. And if more precisely, we will cache only the pure data, no html.
Cacher allows you to cache variables (anything that can be put into a variable) for later use. This speeds up loading time, and reduces load on the data source.