Recall & Review
beginner
What does the Redis
KEYS command do?The
KEYS command finds all keys in the database that match a given pattern.Click to reveal answer
beginner
Why should you avoid using
KEYS in production?Because
KEYS scans the entire database, it can slow down Redis and block other commands, especially with many keys.Click to reveal answer
intermediate
What is a safer alternative to
KEYS for pattern matching in Redis?Use the
SCAN command, which iterates over keys incrementally without blocking Redis.Click to reveal answer
beginner
Give an example pattern you might use with
KEYS.For example,
KEYS user:* finds all keys starting with user:.Click to reveal answer
intermediate
What kind of patterns can
KEYS match?It supports glob-style patterns like
* (any characters), ? (single character), and [abc] (character sets).Click to reveal answer
What does the Redis
KEYS command return?✗ Incorrect
KEYS returns all keys matching the given pattern.Why is
KEYS not recommended in production?✗ Incorrect
KEYS scans all keys at once, which can block Redis and slow down performance.Which command is better for safely scanning keys in Redis?
✗ Incorrect
SCAN iterates keys incrementally without blocking Redis.What pattern would find all keys starting with 'session:'?
✗ Incorrect
The pattern
session:* matches keys starting with 'session:'.Which wildcard matches exactly one character in Redis patterns?
✗ Incorrect
The
? wildcard matches exactly one character.Explain what the Redis
KEYS command does and why it should be avoided in production.Think about how scanning all keys affects Redis performance.
You got /5 concepts.
Describe the difference between
KEYS and SCAN commands in Redis.Consider how each command handles large numbers of keys.
You got /4 concepts.