0
0
Redisquery~10 mins

Eviction policies overview in Redis - 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 Redis eviction policy to remove the least recently used keys.

Redis
CONFIG SET maxmemory-policy [1]
Drag options to blanks, or click blank then click option'
Aallkeys-lru
Bnoeviction
Callkeys-random
Dvolatile-ttl
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'noeviction' which disables eviction.
Choosing 'volatile-ttl' which only evicts keys with expiration.
2fill in blank
medium

Complete the code to set Redis to evict only keys with an expiration time using a random eviction policy.

Redis
CONFIG SET maxmemory-policy [1]
Drag options to blanks, or click blank then click option'
Aallkeys-lfu
Ballkeys-random
Cvolatile-random
Dvolatile-lru
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'allkeys-random' which evicts any key randomly.
Choosing 'volatile-lru' which evicts least recently used keys with expiration.
3fill in blank
hard

Fix the error in the command to set Redis eviction policy to remove the least frequently used keys among all keys.

Redis
CONFIG SET maxmemory-policy [1]
Drag options to blanks, or click blank then click option'
Aallkeys-lfu
Ballkeys-lru
Cvolatile-lfu
Dnoeviction
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'volatile-lfu' which only evicts keys with expiration.
Using 'noeviction' which disables eviction.
4fill in blank
hard

Fill both blanks to set Redis to evict keys randomly but only those with expiration time.

Redis
CONFIG SET maxmemory-policy [1]
CONFIG SET maxmemory [2]
Drag options to blanks, or click blank then click option'
Avolatile-random
Ballkeys-lru
C100mb
Dnoeviction
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'noeviction' as policy which disables eviction.
Setting maxmemory to a non-size value.
5fill in blank
hard

Fill all three blanks to configure Redis to evict the least recently used keys among all keys and set maxmemory to 50mb.

Redis
CONFIG SET maxmemory-policy [1]
CONFIG SET maxmemory [2]
CONFIG SET [3] 5
Drag options to blanks, or click blank then click option'
Aallkeys-lru
B50mb
Cmaxmemory-samples
Dnoeviction
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'noeviction' disables eviction.
Forgetting to set maxmemory or setting it incorrectly.