What if there were a magic wand that gave you a strange power…
A power that allows you to prepare your work beforehand, and every time you need to do something, you just wave the wand, and it gives you the result of the work already done.
How more productive would you be?
In web development, caching plays that kind of a role.
And it’s immensely helpful.
- First, it makes your website load faster because it saves the result of the repeatable server work. Then it gives the user that saved result.
- Caching also saves you money from hosting expenses. If you make your server always work hard, that generates additional cost, proportional to the traffic your website gets (more traffic = more expensive hosting plan).
- On the other hand, faster websites have better chances to attract more traffic from search engines, so caching your HTML documents and other resources can add to your revenue (more traffic = more revenue).
But what exactly is “Caching”?
Let’s explain it this way:
Your website is a complex application for generating documents on the fly. When a user requests a web page, the server redirects that request to your WordPress installation. Once the request’s data is received, WordPress starts creating an “HTML document.”
That means it will make several connections to the database and fetch some needed data. It will process that data by making calculations, filtering it, and other stuff. After that, it will create the result, consisting of text and HTML tags.
All this takes time and server resources to be executed.
The role of caching is to save the generated document in a file or memory for future references. So when another user makes the exact same request, they quickly get the saved one, so a lot of server work is skipped.
The Two General Types of Caching
There are two main types: client-side caching and server-side caching.
That way, these resources load faster, but only if the visitor has already been on your site.
When server-side caching is involved, the HTML document is saved on the server that created it, so it’s available for every user who wants it, but it must be downloaded by the browser every time.
A good plugin does both server-side and client-side caching…
That means it saves the content you create and then serves it from the cache with the proper configuration that instructs the browser how to cache it too.
Also, the plugin controls the “freshness” of the saved copies. There is a specific period for which they are available. And when that period has elapsed or the original document is changed, the plugin saves a new copy.
This behavior ensures that the web users always get current information.
Ok, that’s enough information overflow for today. Next time, I will share how to choose a caching plugin for your websites with no risk of future regrets.
The Code & Marketing Combinator
P.S. I’m excited about BuhalBu’s Kit. The core functionality is now well-defined and coded, so what’s left is to do some refactoring.
Then I’m moving to the funnier things like taking the audits data and making all kinds of colorful reports, so I really love my job right now.