Implement caching in php website

Hi Experts,
Today i am sharing you Step by Step instructions for Implement caching in php website.
First of all we have to understand that what is cache exactly and how cache exactly works .
What is cache ?
Cache is a technique to optimize web page speed,load time and execution . it just reduces database calls and load by delivering contend by cached pages or objects which we saved in file-system or objects .We can Achieve cache with multiple logic like File Storage Cache(Most popular & this article is about itself),Object Stored cache( like Memcache),Application level cache (like Varnish Cache) ,SQL Query Cache.
Simply Cache is not a logic or program it is just a concept and that can be achieve with multiple logic or programs/techniques as above.
Now See that How Cache works with Server and Client See in Following Figure.

cached-file-example

Now Step by Step Implement caching in php website
Step 1 : Create a Cache class with file name cache.class.php in your website root directory

Step 2 : Put Following code Before your website header file/template file or any file where you want to achieve cache.
Note : this code should be always upper from your <html> tag starts.

Step 3 : In the Footer template or page just After the </html> close tag.

Step 4 : Check you page and see that for the time you set in code or by default 1 hour you webpage will give same output for all users very quickly.
Question : how to verify that cache is implemented or not
Answer : load your webpage where you implement this cache system after it CTRL+U or see page source. in that in last of your code there will be a html comment having following text
” cached page by cache class by w3school ”
Now Enjoy the Script by https://www.w3school.info/