Answer the question
In order to leave comments, you need to log in
How to automate caching in Laravel 5?
Is there a ready-made caching automation solution? For example, to override the get() and first() methods without changing the framework files, adding Cache::remember() to them, and specifying the need and time for caching, for example, in the model itself?
Answer the question
In order to leave comments, you need to log in
In Laravel 5 they removed the ability to cache queries, Taylor said that this is "fuu", and do the caching yourself.
The most correct way is to make a repository class, in which to do data caching.
Ie something like this:
- We make an abstract repository Repository, it has a protected $model property;
- Add all standard get/all/first/etc... methods to the Repository and do caching in them.
- Create the required repository UserRepository, in which we set $model = new User;
- ???
- Profit!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question