Back to the Learning!

Laracasts is packed full with over 1,000 lessons just like this one.

Sign up to get full access or log in to your account and sit back.

Published On Oct. 6th 2016

Learn Redis Through Examples: How to Structure Your Caching Layer

Episode 6 Run Time 8:38

Download

Before we move on to learning about PubSub in Redis, let's take a short break to review how we might organize our PHP to best take advantage of caching. In the previous episode, we simply wrapped our database query in a call to Cache::remember(). But, what if we want to dry up our code a bit, or even turn the caching on and off (through the use of decorators), like the flick of a switch? In this episode, I'll demonstrate a few options that you might consider.