Hello I am using memcached
in laravel application 5.8.
After some time the error is:
production.ERROR: Invalid argument supplied for foreach()
Code in controller is:
$page = \Request::get('page', '0');
Cache::tags('posts')->remember('page-'.$page, 15, function(){
return Post::orderBy('created_at', 'desc')
->paginate(20);
});
$posts = Cache::tags('posts')->get('page-'.$page);
The error comes, because of the @foreach
loop in the view.
When I get the error, I can fix it by restarting the server, but this is not really a good solution. How can I prevent this issue and still use memcached
?
I am sure that it comes from the cache, because if I change the cache driver to array
than the error is gone.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire