100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Redis

What Is Redis?

An introduction to Redis as an in-memory data structure store, covering what makes it different from disk-based databases and why it's become a staple of modern backend systems.

Redis FoundationsBeginner8 min readJul 10, 2026
Analogies

What Is Redis?

Redis (REmote DIctionary Server) is an open-source, in-memory data structure store that can be used as a database, cache, message broker, and streaming engine. Unlike traditional relational databases that persist every write to disk before confirming it, Redis keeps its entire working dataset in RAM, which lets it respond to reads and writes in well under a millisecond. It was created by Salvatore Sanfilippo in 2009 to solve a real scaling problem at his own startup, and it has since become one of the most widely deployed data stores in existence.

🏏

Cricket analogy: Just as a wicketkeeper standing right behind the stumps reacts to a nick in a fraction of a second rather than waiting for a slip fielder thirty yards away, Redis keeps data in RAM right next to the CPU instead of on a distant disk, so responses arrive almost instantly.

In-Memory Data Store

Because Redis stores data primarily in RAM, its performance characteristics differ fundamentally from disk-oriented systems like PostgreSQL or MySQL. A simple GET or SET command typically completes in microseconds, and a single Redis instance can handle hundreds of thousands of operations per second on modest hardware. This speed comes with a trade-off: RAM is more expensive and volatile than disk, so Redis deployments must size memory carefully and use persistence mechanisms (covered later) to avoid losing data on a restart.

🏏

Cricket analogy: Virat Kohli chasing a target doesn't recalculate the required run rate from scratch each over — he keeps it in working memory — but if he loses focus (a crash) he needs the scoreboard (persistence) to recover the state, just like Redis needs RDB or AOF.

Data Structures Redis Supports

What sets Redis apart from a simple key-value cache like Memcached is that its values aren't limited to plain strings. Redis natively supports Strings, Lists (linked lists good for queues), Hashes (field-value maps ideal for representing objects), Sets (unordered unique collections), Sorted Sets (Sets ordered by a score, perfect for leaderboards), Streams (append-only logs for event data), Bitmaps, HyperLogLogs (for cardinality estimation), and Geospatial indexes. Each structure has its own command family, such as LPUSH/RPOP for lists or ZADD/ZRANGE for sorted sets, letting developers pick the right tool for each problem instead of serializing everything into JSON strings.

🏏

Cricket analogy: A scorer's tally isn't just one number — it's a structured record with runs, wickets, overs, and extras tracked separately, similar to how Redis offers Hashes to store an object's fields separately rather than cramming everything into one plain string.

bash
# Strings
SET user:1:name "Ada"
GET user:1:name

# Hashes (object-like)
HSET user:1 name "Ada" age 32 city "London"
HGETALL user:1

# Sorted Sets (leaderboards)
ZADD leaderboard 1500 "ada" 1200 "grace"
ZREVRANGE leaderboard 0 2 WITHSCORES

# Lists (queues)
LPUSH jobs:queue "send_email:42"
RPOP jobs:queue

Redis vs Traditional Databases

Redis is not a drop-in replacement for a relational database like PostgreSQL. It has no query language like SQL, limited support for complex joins, and by default trades some durability for speed. Instead, Redis typically complements a primary database: applications cache expensive query results in Redis, store ephemeral session data there, or use it as a fast layer for counters, rate limiters, and pub/sub messaging, while the source of truth for critical, relational data stays in a traditional RDBMS.

🏏

Cricket analogy: A team keeps a quick run-rate calculator on the sidelines for instant decisions during a match, but the official scorebook of record still lives with the scorers — Redis is the sideline calculator, while the RDBMS remains the scorebook of record.

Redis is single-threaded for command execution (as of Redis 6, I/O threading was added for network handling, but command execution remains single-threaded), which is why individual commands are atomic by default — no other command can interleave mid-execution.

  • Redis is an in-memory data structure store used as a database, cache, message broker, and streaming engine.
  • It was created by Salvatore Sanfilippo in 2009 to solve real-world latency problems.
  • Storing data in RAM gives Redis microsecond-level latency, far faster than disk-based databases.
  • Redis supports rich data types beyond simple strings: Lists, Hashes, Sets, Sorted Sets, Streams, Bitmaps, HyperLogLogs, and Geospatial indexes.
  • Command execution in Redis is single-threaded, which makes individual commands atomic.
  • Redis is typically used alongside a relational database rather than as a full replacement for one.
  • Persistence mechanisms (RDB and AOF) exist because in-memory data is otherwise lost on restart or crash.

Practice what you learned

Was this page helpful?

Topics covered

#Redis#RedisStudyNotes#Database#WhatIsRedis#Memory#Data#Store#Structures#StudyNotes#SkillVeris