0
0
Laravelframework~10 mins

Cache configuration in Laravel - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the default cache driver in Laravel's configuration.

Laravel
'default' => env('CACHE_DRIVER', '[1]'),
Drag options to blanks, or click blank then click option'
Amemcached
Bdatabase
Credis
Dfile
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing a driver not installed or configured.
Using 'redis' without Redis installed.
2fill in blank
medium

Complete the code to retrieve a cached value with a fallback in Laravel.

Laravel
$value = Cache::remember('[1]', 60, function () {
    return 'default';
});
Drag options to blanks, or click blank then click option'
Akey_name
Bcache_time
Ccache_driver
Ddefault_value
Attempts:
3 left
💡 Hint
Common Mistakes
Using the cache duration as the key.
Passing the default value as the key.
3fill in blank
hard

Fix the error in the cache configuration array to set the Redis connection.

Laravel
'redis' => [
    'client' => env('REDIS_CLIENT', '[1]'),
],
Drag options to blanks, or click blank then click option'
Aredisclient
Bredis
Cphpredis
Dpredis
Attempts:
3 left
💡 Hint
Common Mistakes
Using an invalid client name.
Confusing client name with connection name.
4fill in blank
hard

Fill both blanks to configure the cache store and its prefix in Laravel.

Laravel
'stores' => [
    'memcached' => [
        'driver' => '[1]',
        'prefix' => '[2]',
    ],
],
Drag options to blanks, or click blank then click option'
Amemcached
Bredis
Claravel_cache
Dapp_cache
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'redis' as driver for Memcached store.
Leaving prefix empty or generic.
5fill in blank
hard

Fill all three blanks to create a cache configuration for a database store with a table and connection.

Laravel
'database' => [
    'driver' => '[1]',
    'table' => '[2]',
    'connection' => '[3]',
],
Drag options to blanks, or click blank then click option'
Adatabase
Bcache
Cmysql
Dredis
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'redis' as driver for database cache.
Wrong table name or connection string.