Laravel Matryoshka
, (*1)
Laravel-Matryoshka is a simple
package for Laravel that provides Russian Doll caching for
your view logic. It uses the "updated at" timestamp of the model, in order to automatic
cache busting whenever the model is updated. Laravel-Matryoshka will extend your
blade view logic in order to create caching segments, which can be managed separately., (*2)
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 cache busting whenever
the model is updated., (*3)
, (*4)
How to install?
Step-01: Composer
Use Composer from the command line and run:, (*5)
composer require sirthxalot/laravel-matryoshka
Step-02: Service Provider
Open config/app.php
, and add a new item to the providers
array:, (*6)
'providers' => [
...
Sirthxalot\Cache\CacheServiceProvider::class,
...
]
This will bootstrap the Laravel-Matryoshka package into your Laravel application., (*7)
Step-03: Setup Cache Driver
For this package to function properly, you must use a Laravel cache driver that
supports tagging (like Cache::tags('foo')
). Drivers such as Memcached
and Redis support this feature., (*8)
Check your .env
file, and ensure that your CACHE_DRIVER
choice accommodates
this requirement:, (*9)
CACHE_DRIVER=memcached
Have a look at Laravel's cache configuration documentation,
if you need any further help., (*10)
Need Further Help
Please take a look at the official documentation,
in order to receive further information about the Laravel-Matryoshka.
It will guide you through all the basics and is the defacto educational resource
specifically for any Laravel-Matryoshka beginner., (*11)
If you have a question, want to report any bug or have any other issue, than please
do not hesitate to use the issue tracker.
Here you will find any tickets, questions and many more, related to Laravel-Matryoshka., (*12)
Contributing
Yet just me helped to get Laravel-Matryoshka what it is today, so lets
change this. Anyone and everyone is welcome to contribute, however, if you decide
to get involved, please take a moment to review the guidelines:, (*13)
License
The code is available under the MIT-License., (*14)