What is caching? Peter Chester explained this very well.
Caching Explained In Not-So-Technical Terms
During a conference, he asked the audience what 3,485,250 divided by 23, 235 is. The audience fell silent, thinking. Some pulled out their calculators to compute until finally, someone gave the answer: 150.
Then he asked the audience the same question again. But this time, the audience was able to give the answer straight away. They didn’t need to compute again, like what they did the first time because they have already done the initial process.
It Enables Your Webpage To Load Fast
In websites, caching simply means all the bits and pieces of your website are stored in a single file so that your computer doesn’t have to do the ‘initial’ processing each time you load the page. This shortens data access times, loading your webpage much faster.
You can also have databases in all major cities around the world. These databases will have a cached copy of your website so that when someone tries to access your site, it goes to the closest cached database instead of going all the way to the main server.
Other Benefits Of Caching
Aside from increasing your page load speed, caching can also help save server memory. It reduces load on your host server, taking the heavy load for recurring operations.
And because it enhances the speed and performance of your site, caching also helps increase your reliability to users.
What To Cache And What Not To Cache?
But caching does present a few issues.
If you decided to change something on the webpage, your computer will continue to load stale (cached) data. This isn’t ideal if you have an ecommerce or a very interactive site where a lot of things are changing on a regular basis.
You’d want to cache resources that don’t change much or don’t change at all like images and PDF’s. The homepage is especially good to cache because people often land there and you want to deliver the page to them as quickly as possible.