Bird
0
0

Which of the following is the correct way to set the default cache driver in Laravel's config/cache.php file?

easy📝 Syntax Q12 of 15
Laravel - Configuration and Environment
Which of the following is the correct way to set the default cache driver in Laravel's config/cache.php file?
A'driver' => 'redis',
B'default' => env('CACHE_DRIVER', 'file'),
C'cache' => 'database',
D'default_driver' => 'memcached',
Step-by-Step Solution
Solution:
  1. Step 1: Check Laravel cache config syntax

    The default cache driver is set with the key 'default' using env() helper.
  2. Step 2: Match correct syntax

    'default' => env('CACHE_DRIVER', 'file'), uses 'default' => env('CACHE_DRIVER', 'file'), which is correct Laravel pattern.
  3. Final Answer:

    'default' => env('CACHE_DRIVER', 'file'), -> Option B
  4. Quick Check:

    Default cache driver set with 'default' key [OK]
Quick Trick: Default cache driver uses 'default' key with env() [OK]
Common Mistakes:
  • Using wrong key names like 'driver' or 'cache'
  • Not using env() helper for flexibility
  • Setting keys that don't exist in Laravel config

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Laravel Quizzes