Laravel 5-缓存记住不起作用 [英] Laravel 5 - Cache remember doesn't work
本文介绍了Laravel 5-缓存记住不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图用Cache :: remember();来缓存一些查询.但这是行不通的.
I have tried to cache some queries with Cache::remember(); but it doesn't work.
我的脚本响应代码是500(内部服务器错误).
My script response code is 500(Internal Server Error).
这是我的代码:
$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);
Storage
权限=> 777
Cache path
=> storage_path('framework/cache')
Storage
permissions => 777
Cache path
=> storage_path('framework/cache')
有人有主意吗?
推荐答案
-
php artisan cache:clear
- 如果您之前已经运行过
php artisan config:cache
,则必须从bootstrap/cache/
中删除config.php
文件,如果没有,则只需运行第一个命令(1.) - 尝试运行代码以缓存数据.
php artisan cache:clear
- if you have run
php artisan config:cache
before then you have to deleteconfig.php
file frombootstrap/cache/
, if not then just run first command (1.) - Try to run your code for caching data.
这篇关于Laravel 5-缓存记住不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文