What Redis is actually used for beyond caching
coreintermediateRedis is best known as a cache, but its speed and atomic operations make it a fit for anything that needs fast, shared, short-lived state — counters, session storage, rate limiting, lightweight coordination locks, and simple queues. The common thread across all of these is: state that many instances need to share, updated frequently, where losing it is tolerable or backed up elsewhere.
Think of it as
Think of Redis as a shared whiteboard in a team's office instead of everyone keeping sticky notes on their own desk (in-process memory). Anyone can read or update it instantly, and because everyone reads the same board, counters and locks written there mean the same thing to everyone — a sticky note on one person's desk means nothing to a coworker in another room.
What we're doing: Implement a fixed-window rate limiter with two atomic Redis commands.
- 3
- INCR is atomic — many concurrent requests incrementing the same key never lose an increment to a race.
- 4
- Only the request that creates the key sets its TTL, so the counter naturally resets at the window boundary.
Why this works: This is the whole rate limiter in two Redis commands — no application-level locking needed, because INCR and EXPIRE are each atomic on the server side.
Using Redis as the sole source of truth for data that must never be lost
Wrong
Better
What you see: A Redis restart, eviction under memory pressure, or replica failover silently loses data a team assumed was safe — because Redis's in-memory nature and (by default) periodic-not-continuous persistence make it a poor fit as the only copy of anything that must survive a crash.
Why: Redis is excellent for fast, shared, short-lived or reconstructible state, but its default persistence (RDB snapshots or AOF) is not the same durability guarantee a primary transactional database gives — using it as the only copy of critical data trades that durability for speed without deciding to.
- Cache — string/hash + TTL
- Counter — atomic INCR/DECR
- Session store — shared across instances
- Rate limiter — INCR + EXPIRE
- Lightweight lock — SET NX EX
- Simple queue — list or stream
Redis use cases and the primitive behind each
Remember: Redis fits anything that needs fast, shared, short-lived state: caching, atomic counters, session storage, rate limiting, lightweight locks, simple queues — not as a substitute for a durable primary store or a full-featured message broker when the workload genuinely needs one.
See also: redis data structures · sync vs async messaging

