Rock U - Caching - Cache Tags v13

Transcribed Video Content

There may be times when you wanna clear cache globally, such as across all content channels. Now, you could go to each block individually and clear out the cache settings to to refresh it, but there's an easier way. So in this video, we're gonna look at how to create and use cache tags. To start, let's configure some cache tags to use. And we can do that under admin tools and CMS configuration and cache manager. And so if we go to the cache manager, there's a couple other items on this page, but what we're focused on here is the cash tags. So out of the box, there are no cash tags, but we can go ahead and add some. So for instance, we can add one for, say, podcasts. We can add one for sermons, and we'll add a couple more. And there we go. So we've got a list of, cash tags. Now as you're creating these, note that they get added as defined values on the cache tag's defined type. So you can delete cache tags by deleting those defined values, but you wanna make sure they're not associated with anything first. And we'll show you how we'll associate those with blocks in a minute. So, let's say for our podcast series, we want to change the image associated with one of the podcasts. Let's take a look. So, here on the external site, we're going to navigate to watch, and we'll click on Moneywise. And let's say that we want to change this image of Ben Franklin. Okay? So in order to do that, we'll need to go back into the internal website under tools, and we can go to content, and then message series, and then there's Moneywise. And we're gonna scroll down here and change this image. Okay. So, we've got a new image uploaded there. Now, let's head back to the external website. And if we go back to watch and money wise, we can see that we still see that same picture of Ben Franklin. And, of course, that's because it's cached. So, we could go into the block settings, and we could come here, and we could go under the advanced settings. And we could change the item cache duration from, from what it is down to zero, and then save it, and then reload it, and then set it back to 3,600. However, in this case, we can use a cache tag. And so, all of the content channel items this are gonna have cache tags, and we're gonna say that this one is part of our podcast. And so we're gonna associate it with the podcast cache tag. So we'll go ahead and save that, and then we'll go back to the internal website. And here from the internal website, we're gonna go back to admin tools, CMS configuration, and cache manager. And now you can see that the podcast cache tag has two linked keys. We've associated it with items out there on our website. Now, if we wanna clear the cache, for everything that has the, podcast cache tag set up, all we have to do is click this eraser icon, and it'll clear the cache for all those items. So remove cached items tagged with podcast. Okay. So with the cache cleared, let's head back to the external website. And, again, if we go back to watch and money wise, we can already see that the picture of Ben Franklin has been replaced with the new picture that we uploaded now that the cache has been cleared. And we did that without having to adjust the cache settings on the individual block. We were able to clear the cache for all items tagged with podcast. So as you can see, using cache tags helps save you time by clearing cache across a variety of content instead of having to go to that content and clearing cache individually. For more details on the cache manager in general and cache tags in particular, you can check out our Rock admin hero guide. We also have a chapter on cache tags in the designing and building websites using Rock guide. Thanks for watching.