0
0
Laravelframework~20 mins

Config caching in Laravel - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Config Cache Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1: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?
AIt encrypts config files to secure sensitive data.
BIt combines all config files into a single file to speed up config loading.
CIt automatically updates config files when environment variables change.
DIt disables config files to improve performance.
Attempts:
2 left
💡 Hint
Think about how loading many files can affect performance.
component_behavior
intermediate
1: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?
AThe app will ignore the cached config and load the new config files.
BThe app will automatically detect and use the new config values immediately.
CThe app will use the old cached config values until you clear or refresh the cache.
DThe app will throw an error because config files changed after caching.
Attempts:
2 left
💡 Hint
Think about what caching means for file changes.
📝 Syntax
advanced
1:00remaining
Identify the correct command to cache config
Which of the following artisan commands correctly caches the configuration in Laravel?
Aphp artisan cache-config
Bphp artisan cache:config
Cphp artisan config-cache
Dphp artisan config:cache
Attempts:
2 left
💡 Hint
Check the exact artisan command syntax.
🔧 Debug
advanced
2: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?
ABecause config caching stores environment variables at cache time, so changes in <code>.env</code> are ignored until cache is rebuilt.
BBecause Laravel does not support environment variables in config files.
CBecause the <code>.env</code> file is deleted after caching config.
DBecause config caching disables environment variables for security.
Attempts:
2 left
💡 Hint
Think about when environment variables are loaded in relation to caching.
lifecycle
expert
2: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?
A1,2
B3,1,2
C1,2,3,4
D2,1,3
Attempts:
2 left
💡 Hint
Focus on clearing and then caching config only.