Rock U - Caching - Cache Tags
Transcribed Video Content
If you've ever noticed that consistently in Rock, as you're loading up a page, the content just takes a long time to show up. Now you may be thinking that it's your fault. It's probably not your fault. You may be thinking it's Rock's fault. It's probably not Rock's fault, but there's something that we can do about it to make these pages load faster and it's called caching.
So the trick with caching is you wanna know how long we wanna save that cached content for, meaning next time you load up the page, Rock will actually remember for you what content was there so you don't need to worry about loading it up again. Let's get into how to set up caching in Rock right now. Let's look at how we can be smart with our caching. So to start, head to admin tools up to settings, and we'll start typing in cache and click on the cache manager. Now you can see this whole dashboard that's popped up, and this is really helpful for you to see how caching is working on the series of cache tags that you have set up.
You can pick different types of cached items that you want to show or you can view the cache on a specific entity. You can pick a cache type as well, so you can get really specific with what you see here, and you can clear all the cache at once as well. But we're gonna look at cache tags. These are really helpful because they'll allow you to tag items with a value, which under the hood, these are just defined values for a cache tags defines type. As you can see, we already have messages, events, news.
Let's add another just so you can see what it looks . We'll name it podcasts, and you can write a description as well to be helpful to other people that come across these tags in the future. Now we've got this tag set up. I'm gonna show you what it looks to add it to an item, but we're gonna do some configuration first. So looking at the external website, we're gonna go click watch.
And what we're gonna do is we're actually gonna change the image on this Moneywise message. So we're gonna click on it, and I'll show you how to enable cash tags. We're gonna go into the block settings for the content channel item view, Then we're going to go to the advanced settings, and here's the caching settings. So you can already select how long you want an items or an item to be cached for. In this case, we're doing thirty six hundred seconds.
But if you want to have a series of items that you can refresh the cache for whenever you want, this is where cache tags come in. So what we're looking at here is a message. I'm gonna mark just one cash tag, but you can set multiple on an item. Click save, and now Moneywise has been marked with that cash tag. Now I'm gonna go back into Rock, and I'm simply going to head to tools, then content.
And I've clicked on message series. This is where our Moneywise item is. I've clicked on it, and now I'm gonna change the image. I've added this big image of a dollar bill. We've changed it from Ben Franklin.
Well, it's still Ben Franklin, but in a different format, if what I'm saying. Then we'll save, and I'm gonna go back to our external website. I'm gonna refresh the page. You'll notice that that new screenshot isn't showing up just yet, but let's clear the cache for that cache tag that we set up. Now back and forth, we're back here.
We're going to go back to admin tools, settings, and back to the cache manager. Then you can see we have this messages tag linked in two places. Simply gonna click on this, and it will flush all the items from the cache that are tied to this tag. There we go. Now, as you can see, we haven't done a full cache reset for the whole website.
But when we come back and we refresh, we have that new image that we were looking for, really easy and simple, and we didn't have to refresh the cache for the entire website, only those relevant items. Caching is one of those things you usually set once and then you forget about it. So get used to some faster loading on your website now that you've set up some cache tags.