Challenge - 5 Problems
Config Cache Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
What does Laravel's config caching do?
Laravel offers a command to cache configuration files. What is the main benefit of using config caching in a Laravel application?
Attempts:
2 left
💡 Hint
Think about how loading many files can affect performance.
✗ Incorrect
Config caching merges all config files into one cached file. This reduces file reads and speeds up config loading.
❓ component_behavior
intermediate1:30remaining
Effect of config caching on config changes
If you run
php artisan config:cache and then change a value in config/app.php, what will happen when you reload your Laravel app?Attempts:
2 left
💡 Hint
Think about what caching means for file changes.
✗ Incorrect
After caching config, Laravel uses the cached file. Changes to config files won't apply until cache is cleared or rebuilt.
📝 Syntax
advanced1:00remaining
Identify the correct command to cache config
Which of the following artisan commands correctly caches the configuration in Laravel?
Attempts:
2 left
💡 Hint
Check the exact artisan command syntax.
✗ Incorrect
The correct command is php artisan config:cache. Others are invalid and cause errors.
🔧 Debug
advanced2:00remaining
Why does config caching cause stale environment variables?
After running
php artisan config:cache, you notice your app does not reflect changes made in the .env file. Why does this happen?Attempts:
2 left
💡 Hint
Think about when environment variables are loaded in relation to caching.
✗ Incorrect
Config caching compiles config and environment variables into one file. Changes to .env won't apply until cache is cleared and rebuilt.
❓ lifecycle
expert2:30remaining
Order of commands to update config cache after changes
You updated your
.env and config/database.php files. Which sequence of commands correctly updates the config cache to reflect these changes?Attempts:
2 left
💡 Hint
Focus on clearing and then caching config only.
✗ Incorrect
The correct lifecycle is to clear the config cache, then rebuild it. cache:clear clears other caches but is not required here. config:refresh is not a valid command.