What Is Redis? The In-Memory Database Explained (and When to Use It)
Redis is an in-memory key-value database used for caching, sessions, leaderboards and pub/sub messaging. Here's how it works, how it differs from Postgres, and the 2024-2025 licensing saga.

Redis is an in-memory, key-value data store: instead of reading and writing records from spinning disks or SSDs like a traditional database, it keeps its entire dataset in RAM, which is what lets it answer most requests in well under a millisecond. That single design choice is why Redis has become the default answer to "how do I make my app faster" for millions of developers, and why it sits underneath caching layers, session stores, real-time leaderboards, and message queues at companies of every size.
- What it is: An open-source, in-memory key-value data store (sometimes called a "data structure server")
- Created: 2009, by Salvatore Sanfilippo ("antirez"), first released February 26, 2009
- Written in: C
- Core data types: strings, hashes, lists, sets, and sorted sets, plus newer types like streams and vector sets
- Typical uses: caching, session storage, real-time leaderboards, pub/sub messaging, rate limiting
- Current licensing: Redis 8 and later offer the OSI-approved GNU AGPLv3 as an open-source option, alongside Redis's dual source-available licenses (RSALv2/SSPLv1)
What is Redis?
Redis — short for REmote DIctionary Server — is an in-memory data store that developers use as a database, cache, and message broker. According to Redis's own documentation, Redis is best described as a "data structure server": rather than storing only flat strings the way many caches do, it natively understands richer structures such as hashes, lists, sets, and sorted sets, and lets you operate on them with fast, atomic commands.
Salvatore Sanfilippo built the first version of Redis in 2009 while trying to speed up a real-time web log analyzer for his own startup. He prototyped it in Tcl, rewrote it in C, and released it as open-source software; Redis was later sponsored by VMware, then Pivotal Software, and then Redis Labs (later renamed Redis Ltd.) as the project grew into one of the most widely deployed pieces of data infrastructure on the internet.
Because the whole dataset normally lives in memory, Redis can execute most read and write operations in sub-millisecond time. It can still persist data to disk for durability (through snapshotting or an append-only log), but memory — not disk — is the primary copy of the data that Redis reads and writes against.
How Redis differs from a disk-based database like PostgreSQL
A traditional relational database such as PostgreSQL is built around durable, disk-based storage: it organizes data into tables and rows, enforces a fixed schema, supports complex multi-table joins, and guarantees strong transactional consistency (ACID) by writing changes to disk before confirming them. That durability-first design is exactly what you want for a system of record — orders, invoices, user accounts, anything you cannot afford to lose.
Redis takes a different default trade-off. It keeps data in RAM for speed, uses simple key-value and data-structure access patterns instead of SQL joins, and historically treated persistence as a safety net rather than the primary guarantee. That makes Redis extremely fast for the kinds of reads and writes that don't need relational modeling, but it is not generally used as the sole system of record for data you can't regenerate. In practice, most production stacks run Redis alongside a disk-based database rather than instead of one — for example, pairing Redis with a relational store whose own release cycle, like PostgreSQL's latest major version, continues to add features for the durable, relational side of the stack.
| Redis | PostgreSQL | |
|---|---|---|
| Primary storage location | RAM (in-memory), with optional disk persistence | Disk (SSD/HDD), with memory used for caching |
| Data model | Key-value / data structures (strings, hashes, lists, sets, sorted sets) | Relational tables with rows, columns, and a fixed schema |
| Query style | Simple commands keyed by a specific key (e.g., GET, HGET, ZADD) | SQL, including multi-table joins and aggregations |
| Typical latency | Sub-millisecond for in-memory operations | Single-digit milliseconds or more, depending on disk I/O |
| Best suited for | Caching, sessions, counters, queues, real-time data | System-of-record data requiring strong consistency and complex queries |
The core Redis data structures
Unlike a plain key-value cache that only stores strings, Redis's documentation describes several native data types that map closely to structures programming languages already use, which is part of why it's so quick to build with. The five foundational types are:
| Data type | What it is | Common use |
|---|---|---|
| Strings | The most basic type: a sequence of bytes (text, a serialized object, or a number) | Simple caching, counters, feature flags |
| Hashes | Field-value pairs, similar to a dictionary or map | Storing an object's fields, such as a user profile |
| Lists | Ordered collections of strings, sorted by insertion order | Queues, activity feeds, recent-items lists |
| Sets | Unordered collections of unique strings | Tracking unique visitors, tags, or membership |
| Sorted sets | Unique strings ordered by an associated numeric score | Real-time leaderboards, priority queues, ranking |
Beyond these five, Redis also documents more specialized types: streams (an append-only log for event data), geospatial indexes, HyperLogLog and other probabilistic structures for approximate counting, JSON for nested document storage, and — as of Redis 8 — vector sets, a type built specifically for high-dimensional vector similarity search in machine-learning and semantic-search applications, a use case that overlaps with purpose-built vector databases used for AI and retrieval-augmented generation.
Common Redis use cases
Most teams reach for Redis to solve one of a handful of recurring problems:
- Caching. The single most common use: store the result of an expensive database query or API call in Redis so repeat requests are served from memory instead of hitting the slower system of record again.
- Session storage. Web applications often keep logged-in user sessions in Redis so any application server in a cluster can read the same session data, instead of pinning a user to one machine.
- Real-time leaderboards. Redis's sorted sets let you add a player's score and retrieve a ranked leaderboard, or a specific player's rank, in a single fast operation — a pattern Redis's own documentation highlights as a classic sorted-set use case.
- Pub/sub messaging. Redis supports a publish/subscribe messaging pattern, where one client publishes a message to a channel and any number of subscribed clients receive it instantly, useful for chat, notifications, and real-time updates.
- Rate limiting. Because Redis can atomically increment a counter and set it to expire, it's a common building block for API rate limiters that cap how many requests a client can make in a given time window.
- Queues and streams. Redis lists and streams are frequently used as lightweight task queues or event logs between services.
Is Redis a database or just a cache?
Both, depending on how you configure and use it. Redis started out as — and is still very often used purely as — a cache sitting in front of a slower primary database. But Redis also supports persistence: it can periodically snapshot the in-memory dataset to disk, or append every write to a log file that can rebuild the dataset on restart. With persistence enabled, Redis can and does serve as a primary data store for data such as counters, queues, and real-time state, not only as a cache. The right answer for any given project depends on whether the data in Redis needs to survive a restart and how tolerant the application is of losing the very latest writes if the process stops unexpectedly.
Redis vs. Valkey: the licensing fork, explained
If you've searched for Redis recently, you may have also seen references to "Valkey" and a debate over whether Redis is still open source. Here is the timeline, according to Redis's own announcements:
- March 20, 2024: Redis announced that, starting with Redis 7.4, all future releases would move away from the three-clause BSD license and instead be dual-licensed under the Redis Source Available License (RSALv2) and the Server Side Public License (SSPLv1). Redis said this was intended to stop large cloud providers from offering Redis as a competing managed service without contributing back, while leaving the experience unchanged for ordinary developers. Redis itself acknowledged in its FAQ that this meant Redis was "no longer open source" under the Open Source Initiative's definition, and it began calling the freely available version "Redis Community Edition" rather than "Redis OSS."
- Shortly after: In response to that change, the Linux Foundation announced a community-governed fork of the last BSD-licensed version of Redis, named Valkey, backed by major cloud providers and other contributors who wanted to keep developing an OSI-approved, open-source version of the codebase.
- November 2024: Salvatore Sanfilippo, Redis's original creator, rejoined the company as a developer evangelist, according to Redis's own blog.
- May 1, 2025: Redis announced that Redis 8 would add the GNU Affero General Public License v3 (AGPLv3) — an OSI-approved open-source license — as an additional licensing option, alongside integrating the former Redis Stack features (JSON, time series, probabilistic types, the query engine, and the new vector sets type) directly into core Redis under that same AGPLv3 license.
In short: Redis moved away from a permissive BSD license to source-available licensing in 2024, prompting a community fork, and then added back an OSI-approved open-source license (AGPLv3) with Redis 8 in 2025. If you're evaluating Redis today, the practical takeaway is to check which version and license track you're adopting — Redis 8+ under AGPLv3, Redis's source-available dual license, or a community fork such as Valkey — since the terms differ and have changed more than once in a short period.
Is Redis free to use?
Yes, in the sense that matters for most developers: Redis Community Edition remains free to download, run, and use in production, and Redis 8 gives you the option of the OSI-approved AGPLv3 license in addition to Redis's own source-available dual license. The commercial restrictions Redis has added since 2024 are aimed at organizations that want to resell Redis itself as a competing hosted service, not at ordinary application developers running Redis for their own product. Redis Ltd. also continues to sell managed and enterprise offerings (Redis Cloud and Redis Enterprise) for teams that don't want to self-host.
Getting started with Redis
Redis is typically run as a standalone server process that your application talks to over a lightweight binary protocol, with official and community client libraries available for most major programming languages. For local development and many production deployments, Redis is commonly run as a container — it's one of the most frequently pulled images on container registries — so a project that's already containerized with Docker can usually add Redis alongside its other services with a single extra container definition. From there, teams scale Redis either by running a managed cloud offering, clustering it themselves, or adopting one of the community-governed forks that emerged from the 2024 licensing change, depending on which license terms and operational model best fit the project.
What to read next
Redis's own combination of speed, simple data structures, and flexible persistence is why it keeps showing up as the default caching and real-time layer behind modern applications, even as its licensing terms have shifted since 2024. If you're deciding how Redis fits into a broader stack, it's worth comparing it against the durable database it usually sits in front of, and against the newer categories — containers and vector search among them — that increasingly share a deployment with it.
Frequently asked questions
What is Redis used for?
Redis is most commonly used for caching database queries and API responses, storing user sessions, powering real-time leaderboards with its sorted sets, handling publish/subscribe messaging between services, and rate-limiting API requests. It's also used as a lightweight queue and, in some setups, as a primary data store for data that benefits from in-memory speed.
What is Redis cache?
Redis cache refers to using Redis as a caching layer in front of a slower system, typically a disk-based database. The application checks Redis first for frequently requested data; if it's there (a cache hit), Redis returns it in sub-millisecond time, and only on a cache miss does the application fall back to the primary database.
Is Redis a SQL database?
No. Redis does not use SQL or a relational table structure. It's a key-value and data-structure store: you read and write data by key, using commands tied to the data type involved (strings, hashes, lists, sets, or sorted sets), rather than writing SQL queries across joined tables.
Is Redis still open source?
It depends on the version. Starting with Redis 7.4 in March 2024, Redis moved from the permissive BSD license to a dual Source Available License (RSALv2/SSPLv1), which is not OSI-approved open source. Starting with Redis 8 in May 2025, Redis added the OSI-approved GNU AGPLv3 as an additional licensing option, so current Redis releases are available under an open-source license again.
What is the difference between Redis and Valkey?
Valkey is a community-governed fork of Redis, created by the Linux Foundation from the last BSD-licensed version of Redis after Redis Ltd.'s 2024 licensing change. Valkey remains under the permissive BSD-style open-source license, while Redis itself now offers either its source-available dual license or, since Redis 8, the AGPLv3 license.
Does Redis require a schema?
No. Redis does not enforce a fixed schema the way a relational database does. Each key simply holds a value of a particular data type (a string, hash, list, set, or sorted set, for example), and it's up to the application to decide how those keys and structures are organized.
Sources
- Redis: Redis Adopts Dual Source-Available Licensing (2024)redis.io
- Redis: Redis is now available under the AGPLv3 open source license (2025)redis.io
- Redis Docs: Redis data typesredis.io
- Redis Docs: Persistenceredis.io
- Wikipedia: Redisen.wikipedia.org
- Wikipedia: Valkeyen.wikipedia.org
Felix Moreau writes Pandromeda's software coverage and how-to guides. He covers Windows, macOS and Linux updates, the apps people rely on, emulators and developer tools, and turns official documentation into clear, numbered steps that work on the current version.

