Laravel 5 - 缓存记忆不起作用

3

我尝试使用Cache::remember()缓存一些查询结果,但它没有起作用。

我的脚本响应代码是500(内部服务器错误)。

这是我的代码:

 $filters = \Cache::remember("cache_filter", 20, function(){
      $data['value1'] = MyClass::where('<condition>')->get();
      $data['value2'] = MyClass::where('<condition>')->get();
      $data['value3'] = MyClass::where('<condition>')->get();

      return $data;
 });     
 return view('custom.show')->with($filters);

存储权限 => 777
缓存路径 => storage_path('framework/cache')

有人有想法吗?


1
将app.php文件中的debug参数值设为true,以获取更多有关错误的信息。 - Farid Movsumov
仍然相同 - 没有错误预览。 - Heril Muratovic
@HerilMuratovic 你没有看到堆栈跟踪吗? - brainless
没有。没有错误。 - Heril Muratovic
第一次调用时,它会显示数据,但每次下一次调用都会出现内部服务器错误,没有预览错误。 - Heril Muratovic
1个回答

4
  1. php artisan cache:clear
  2. 如果您之前运行了php artisan config:cache,那么您需要从bootstrap/cache/中删除config.php文件,否则只需运行第一个命令(1.)即可。
  3. 尝试运行代码以缓存数据。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接