I was trying to store a complete page view to cache, but error of "Serialization of 'Closure' is not allowed" happened. in controller my code was something like this :
$view = Cache::remember('articles_index', 5, function () {
return view('template.blade.php'); // this is some rendered html string
});
I didn't know the reason, so tried to Google it to find out, but google results was not exactly what I wanted... After a while I find a temporary solution.
$view = Cache::remember('articles_index', 5, function () {
return htmlspecialchars(view('template.blade.php'));
});
this way of caching works, but it may broke some parts of html. still trying to find the perfect solution...
this question may update several times...