Basics for Rediss
Redis basics are the core commands and data types you use to store and read values by key. Strings, hashes, lists and sets cover most simple needs, and key naming, expiry with EXPIRE and TTL, and atomic operations like INCR round out the toolkit. Everything else in Redis builds on these commands.
Stage: Data Types · Part of the Redis roadmap · Last reviewed 19 November 2026
What to learn in Basics
- Store and read values with SET, GET and key expiry
- Increment counters atomically using INCR and INCRBY
- Model an object as a hash with HSET and HGETALL
- Use lists as queues or stacks with LPUSH and RPOP
- Compare sets and sorted sets for uniqueness and ranking
Basics interview questions
Why is INCR safe to use for counters under concurrency?
Redis executes each command atomically on a single thread, so INCR reads, adds one and writes back without another client interleaving. Two clients calling INCR at the same moment both get distinct results. A GET followed by SET from the client would not be safe.
Why avoid the KEYS command in production?
KEYS scans the entire keyspace in one blocking call, and Redis processes commands on one thread, so every other client waits. On a large dataset that can cause visible latency. SCAN returns results in small batches with a cursor and does not block for long.
Where Basics fits in the Redis roadmap
Basics belongs to the Data Types stage (beginner level), which takes about 12 hours. Core commands.
Other units in this stage
Back to the full Redis roadmap