Back Button Laravel

Russian-Doll Caching in Laravel

Popularized in the Rails world, Russian Doll caching is an interesting approach, where you create nested fragment caches for your view logic. If you then link the keys for each of these cached items to the model's "updated at" timestamp, what you get is easy caching for your view logic, and automatic cachebusting whenever the model is updated.

In this series, we'll build a custom package from scratch to offer this very functionality.

Advanced
Difficulty
7 episodes
1:37:45 hrs
Start Series
  • Latest Episode: Registering With Packagist

  • Like this series? Share the love!

    1. Let's begin by learning what Russian Doll caching actually is, and then moving on to the initial project setup, where we install both Laravel and Homestead for the project.

    2. Before we can starting building our caching system, we first need some sample data to cache. So let's use this idea of an index card and notes. In this lesson, we'll build up the necessary route, models, and migrations.

    3. Run Time 29:00

      Now that we have all the setup out of the way, let's write a custom Blade directive so that we may begin implementing our Russian Doll caching mechanism.

      View the source code for this lesson (and the series so far) on GitHub.

    4. Run Time 7:38

      At this point, our experiment is working. However, for any new project, we'd have to copy all these files over. Gross. Let's instead begin creating a reusable package, which we can then pull in through Composer.

    5. Before we make this package available on Packagist.org, let's do some refactoring and write some tests. As you'll find, these tests might drive us toward a slightly different design. Let's see!

    6. So far, we've been building our package in isolation. But, of course, we need to try this out within the context of an actual Laravel project. How exactly do we do that? Well, as it turns out, we can install local repositories with Composer quite easily. In this lesson, we'll do our final tweaks in preparation for Packagist.org.

    7. The initial version of our package is ready to release. Naturally, there are a number of improvements we can make, but what we have so far is good enough for a 0.1.0 release. So let's register our package with Packagist.org.

      View the source code for this package on GitHub. Please note that further commits will have been made to the repo, since the release of this video. Have a look at the commit history to review any specifics that interest you.

You May Also Enjoy...

Here are some additional series that may be up your alley.

Vue Laravel and the Front-end
Beginner
Difficulty

Let's take a break from the back-end, and instead focus on that other world: the front-end! Don't worry, Laravel 5 has made this process as enjoyable...

49:57 mins
Play
Laravel Laravel 5 Fundamentals
Beginner
Difficulty

Each year, the Laracasts "Laravel From Scratch" series is refreshed to reflect the latest iteration of the framework. This is the 2015 edition, which...

5:43:35 hrs
Play
Laravel Advanced Eloquent
Advanced
Difficulty

Sure, you've learned the essentials of using Eloquent in your applications, but do you really understand what's going on under the hood? Well, that's...

58:10 mins
Play
Laravel Intermediate Laravel
Intermediate
Difficulty

Made your way through Laravel 5 Fundamentals yet? Nice job! It's time to dig a bit deeper. In this series, not only will we review higher level featur...

2:30:07 hrs
Play
Laravel What's New in Laravel 5.1
Beginner
Difficulty

Laravel 5.1 includes a variety of welcomed new features. Everything from broadcasting events, to massively improved testing facilities, to LTS support...

2:11:21 hrs
Play
Laravel Build "ProjectFlyer" With Me
Intermediate
Difficulty

In this series, from scratch, you'll come along with me as I build a web app, called "Project Flyer." We'll tackle everything from the domain name pur...

2:47:33 hrs
Play
Laravel Eloquent Techniques
Beginner
Difficulty

For any Laravel user, a solid understanding of Eloquent is crucial. In this series, we'll review a number of key techniques for your toolbelt.

50:20 mins
Play
Laravel What's New in Laravel 5.2
Beginner
Difficulty

It's about that time again. Laravel 5.2 is on its way (possibly in January, 2016), with a variety of useful new additions. Let's get ahead of the game...

49:50 mins
Play
Laravel Laravel 5.2 From Scratch
Beginner
Difficulty

Each year, the Laracasts "Laravel From Scratch" series is refreshed to reflect the latest iteration of the framework. This is the 2016 edition, which...

3:26:05 hrs
Play
Laravel Laravel Authentication Techniques
Intermediate
Difficulty

While Laravel offers a robust, traditional authentication setup out of the box, you may find that you require unique setups for certain projects. Perh...

52:32 mins
Play
Laravel What's New in Laravel 5.3
Intermediate
Difficulty

It's about that time again! The release of Laravel 5.3 is imminent. That means, it's finally time to dig in and see what's new. And, well, there's a l...

2:43:50 hrs
Play
Laravel What's New in Laravel 5.4
Intermediate
Difficulty

It's that time of year again! Laravel is on the cusp of graduating to version 5.4. Along with it comes a variety of excellent new optimizations and fe...

32:17 mins
Play
Laravel Let's Build A Forum with Laravel and TDD
Advanced
Difficulty

A forum is a deceptively complex thing. Sure, it's made up of threads and replies, but what else might exist as part of a forum? What about profiles,...

19:29:26 hrs
Play
Laravel What's New in Laravel 5.5
Intermediate
Difficulty

Here we go again! Currently scheduled for an August release date, we're on the verge of Laravel 5.5. With that in mind, let's get a head start on the...

1:31:44 hrs
Play