An Example of What Happens When a Webpage Loads Without Caching:
Someone comes to your website via a search engine or outside source like social media. They land on one of your webpages, such as the homepage or a product page.
An HTTPS request is put into effect, telling your web server to compile all files to deliver that webpage. Each element (image, script, and file) that goes into that page takes time for the server to compile.
After all site files and elements are requested and loaded, the user sees the entire webpage.
Again, it depends on the file sizes and the number of files on that page, but it’s a lot of work for your server to piece together the right components of a webpage every time someone wants to view it.
An Example of What Happens When a Webpage Loads with Caching in Place:
Someone comes to your website and ends up on an individual webpage.
An HTTPS request gets sent to your server to compile files and deliver the webpage in full form.
Caching is enabled, so the web server sees no changes since the last visitor tried to access the site. It reaches for a static version of the site in its cache storage, removing the server’s need to compile and deliver all website files from scratch.
All visitors see a cached version of your webpage until a content change is made to the page. The cache also restarts when the cache storage is automatically or manually cleared.
A way to visualize caching is by imagining that you’re a painter selling your artwork at a fair. Potential customers come to you and love one of your pieces. However, painting that same landscape over-and-over takes lots of your own time, and people may not be willing to wait around. Therefore, you might make a digital copy of the original painting and print them instead. This way, you get more sales, and your customers don’t have to stick around for a long creation process.
Caching works similarly, copying what’s already there so that the server (the painter in this example) doesn’t have to work so hard, and the users (the painter’s customers) get what they came for in a shorter period of time.