Answer the question
In order to leave comments, you need to log in
Is there a library for caching before the event occurs (Laravel)?
Laravel has a cache class that caches for a certain amount of time.
The idea is simple - cache before the event occurs. Those. caching does not occur for a certain time, but until a certain event occurs. I’m doing just that, but, perhaps, everything has already been invented before me and is actively used, and only I don’t know.
Answer the question
In order to leave comments, you need to log in
If you pass a timestamp instead of a time in minutes, the cache will live until this time
$expiresAt = now()->addMinutes(10);
Cache::put('key', 'value', $expiresAt);
https://github.com/GeneaLabs/laravel-model-caching
There is such a library.
You do Cache::forever(), and when an event occurs, inside the handler - Cache::remove() (or delete, I don't remember). There is no prettier solution, and it is not particularly necessary - it is too specific a case.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question