BeCuriouzBeCuriouz

Learn something new every day

🛠️ Tools & Services
⚡

Redis is a database that keeps everything in RAM — on purpose

💡 Redis trades disk for RAM and plain keys for real data structures, making it a fast layer for caching, queues, and rankings alongside your main database.

Most databases store data on disk and pull it into memory only when needed. Redis flips that: it holds your entire dataset in RAM, treating memory as the primary home for data rather than a temporary cache. That's why reads and writes land in sub-millisecond time — there's no disk seek in the hot path. According to the official docs, Redis can act as a database, cache, streaming engine, and message broker, all from the same engine.

The other surprise is that Redis isn't a key-to-string lookup table. It's a data structure store: each key can hold a string, list, hash, set, sorted set, stream, or more, and Redis gives you atomic commands to manipulate those structures directly on the server. Want a leaderboard? A sorted set ranks members by score automatically. Need a job queue? A list with blocking pop does it. The logic lives next to the data instead of round-tripping to your app.

Because RAM is volatile, Redis offers persistence options — periodic snapshots (RDB) and an append-only log (AOF) — so a restart doesn't wipe everything. But its defining trade-off stays the same: you accept memory limits and cost in exchange for speed and rich in-memory operations. That's why it usually sits beside a traditional database, absorbing the fast, high-frequency work.

⚡ Redis is a database that keeps everything in RAM — on purpose — BeCuriouz