2016-03-11 78 views
0

我試圖用Cache :: remember()緩存一些查詢。但它不起作用。Laravel 5 - 緩存記住不起作用

我的腳本響應代碼是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); 

Storage權限=>777
Cache path =>storage_path('framework/cache')

有沒有人有一個想法?

+1

使app.php中調試參數的值爲true以獲取有關錯誤的更多信息。 –

+0

仍然一樣 - 沒有預覽錯誤。 –

+0

@HerilMuratovic你沒有看到堆棧跟蹤? – brainless

回答

1
  1. php artisan cache:clear
  2. ,如果你以前然後運行php artisan config:cache你必須從bootstrap/cache/刪除config.php文件,如果沒有的話只是運行第一個命令(1)
  3. 嘗試運行代碼緩存數據。