Build the mental model
A Redis key is a binary-safe string in a global namespace. A pattern such as `app:entity:id:purpose` clarifies ownership and debugging and can include environment or tenant boundaries. `KEYS *` scans the entire dataset at once and can block production. Incremental `SCAN` is safer, but it is not a snapshot and may observe duplicates or miss concurrent changes.
Connect it to a real scenario
Use keys such as `tutorial:42:card`, `session:<token>`, `rate:user:42:<window>`, and `leaderboard:weekly:2026-W35`. Inspect unknown keys with `TYPE`, `TTL`, `MEMORY USAGE`, and `OBJECT ENCODING`, then iterate in batches with `SCAN MATCH tutorial:* COUNT 100`.
Try the working example
SET tutorial:42:card '{"title":"Redis"}' EX 300
TYPE tutorial:42:card
TTL tutorial:42:card
MEMORY USAGE tutorial:42:card
SCAN 0 MATCH tutorial:* COUNT 100You get the key type, remaining TTL, memory estimate, and cursor-based scan results.5-minute try-it
Design a key convention separating development/production and two tenants, then create five example keys.
One important caution
Putting raw user input directly into keys can create unbounded cardinality, collisions, and sensitive-data leaks. Normalize or hash it and enforce limits.
Redis — Keyspace — Redis