Introduction to Server Side Caching
Caching is a word often used in web development, but what does it actually mean? We’ll talk about different methods of caching, and what’s actually happening.
Things mentioned in the video:
https://wp-rocket.me/
https://www.nexcess.net/wordpress/
Transcription:
Hey folks! Welcome to another HeroPress Tip Of The Week. I’m Topher and this week we’re going to talk about caching, specifically server-side caching. You may have heard this word tossed around and I’m going to explain briefly what’s actually going on. We’re looking here at the definition of cache and it’s “a hiding place especially for concealing and preserving provisions or implements”. You can think of a squirrel having a cache of nuts but it’s also “a computer memory with very short access time used for storage of frequently or recently used instructions or data” and as a verb you can cache something so computers will cache some data. Squirrels will cash peanuts. So let’s look at a web page here real quick. This is a WordPress page and when you load this page if there is no caching in place a number of things happen.
First your request hits the web server then the web server usually fires up a server-side scripting language like PHP. Then PHP will go talk to the database sometimes as many as hundreds of times per page load and then it goes and gets all that data, brings it all back, and then runs multiple PHP files from all over the server and ends up building a web page that looks a little like this. And it’s just code, it’s just text. There’s only one file here and it’s really long but this is the code that makes this web page
Now every time someone goes to this webpage it has to do all of that work. Caching means saving this file on the server and then next time somebody comes and says I would like this webpage it says “I don’t need to go build the whole thing again I just did that! Let’s give them the copy we saved” and there it is. And it’s way way faster! Way faster. Now you see you may say “Well what happens if I change my web page?” Well good caching systems can know when you hit update on a post and it can flush the cache and then the next person gets the slow version. Or maybe it’s really intelligent and it builds it for you without a request so that even the first person gets a fast copy so a good caching system can be intelligent about when your content changes.
But where do you get this caching system? Well there’s a couple of ways. One is with a plug-in. This is my site here and under settings you’ll find WP Rocket and this is a wonderful plug-in. It works very very well. In my opinion it’s the best plug-in available and it has many options there’s some cache options, file optimization, media, all of that. But one of the great things about it is that you can install it and turn it on and the default settings will work for you, so you don’t have to get into fine tuning if you don’t want to. Your site will simply be faster now this is a plugin we installed in WordPress but additionally some hosts provide caching with the theory that you don’t need a plugin. For example here’s Siteground, and if you go into your dashboard for your site there’s caching right there and remember all the different settings we saw in WP Rocket well here in Siteground the only settings really are to turn it on and that’s it. Once it’s on it just does its thing.
Now one of the advantages of a hosted caching system is that they know their own system they know the fastest way to cache things. Another thing is with a WordPress based plugin it might still be running PHP and MySQL until it figures out that you have a cached copy and sending it. Now one of the great things about WP Rocket is that it does a few more things than that and it’s smart enough to be aware of a hosted caching system so you can install WP Rocket alongside most hosted cache systems and use a few extra tools. Let me show you one more option, Nexcess in their hosting admin doesn’t have a caching area they put it right in your WordPress site. So this is my site and it looks like a plug-in but it’s not it’s it’s their server side custom cache. And again all you really have to do is turn it on right here and everything else should work just fine unless you want to get fancy and start fiddling with things. You certainly may but you don’t have to. Just turn it on and it goes. So caching is saving a copy of your web page after it’s been built the first time and serving that copy to every successive user and then either it gets flushed when you update new content or you can set it for a time. Basically you can say “just keep my cash for an hour and then get a new a new copy” and that works just fine as well. So caching makes your site much much faster by serving just a copy of what the last person got. If you’re not running caching on your own site I really highly recommend it. It’s extraordinarily important for site speed. Look at what your host offers. If they don’t offer anything get a plug-in. There are a bunch. WP Rocket is my favorite but there are others that work well also so look around find what works for you and get caching going on your server.