3

I have tried to cache some queries with Cache::remember(); but it doesn't work.

My script response code is 500(Internal Server Error).

Here is my code:

 $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 permissions => 777
Cache path => storage_path('framework/cache')

Does anyone have an idea?

5
  • 1
    make value of debug parameter in app.php true to get more information about error. Commented Mar 11, 2016 at 11:49
  • still the same - no errors previewed. Commented Mar 11, 2016 at 12:38
  • @HerilMuratovic You are not seeing a stack trace? Commented Mar 11, 2016 at 12:56
  • no. there is no errors. Commented Mar 11, 2016 at 13:00
  • on the first call it shows me the data but every next call is internal server error with no errors previewed. Commented Mar 11, 2016 at 13:23

1 Answer 1

4
  1. php artisan cache:clear
  2. if you have run php artisan config:cache before then you have to delete config.php file from bootstrap/cache/, if not then just run first command (1.)
  3. Try to run your code for caching data.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.