Answer the question
In order to leave comments, you need to log in
How to properly cache JSON in laravel?
I cache JSON like this
$json = file_get_contents('http://json/');
Cache::put('key',$json,5);
$cache = Cache::get('key');
Answer the question
In order to leave comments, you need to log in
This is how the third-party service will be called no more than once per minute:
Cache::remember('key', 60, function () {
return file_get_contents('http://json/');
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question