# Redis

Redis is an in-memory key-value database used as a distributed cache and message broker, with optional durability. It offers low-latency reads and writes, making it suitable for caching and real-time applications.

Redis (Remote Dictionary Server) is an in-memory key-value database, used as a distributed cache and message broker, with optional durability. Because it holds all data in memory and because of its design, Redis offers low-latency reads and writes, making it particularly suitable for use cases that require a cache. The project was developed and maintained by Salvatore Sanfilippo, starting in 2009, and has evolved through multiple sponsorships and licensing changes to become a widely adopted data infrastructure component.

Redis functions as both a data store and a cache, distinguishing itself from traditional relational database management systems (RDBMS). Its data model is based on abstract data types rather than SQL queries, and it is optimized for direct retrieval without secondary indexes or aggregations. This design, combined with its in-memory operation, enables sub-millisecond response times for many workloads.

## History

The Redis project began when Salvatore Sanfilippo (nicknamed antirez) was trying to improve the scalability of his Italian startup and developed a real-time web log analyzer. After encountering significant problems in scaling some types of workloads using traditional database systems, Sanfilippo began in 2009 to prototype a first proof of concept version of Redis in Tcl. Later, Sanfilippo translated that prototype to the C language and implemented the first data type, the list. After a few weeks of using the project internally with success, Sanfilippo decided to open source it, announcing the project on Hacker News. The project began to get traction, particularly among the Ruby community, with GitHub and Instagram being among the first companies adopting it.

Sanfilippo was hired by VMware in March 2010. In May 2013, Redis was sponsored by Pivotal Software (a VMware spin-off). In June 2015, development became sponsored by Redis Ltd. In October 2018, Redis 5.0 was released, introducing Redis Stream, a new data structure that allows storage of multiple fields and string values with an automatic, time-based sequence at a single key. In June 2020, Sanfilippo stepped down as Redis' sole maintainer, succeeded by Yossi Gottlieb and Oran Agra. Sanfilippo returned to Redis in December 2024.

## Licensing Evolution

In August 2018, to control usage of the software by managed cloud providers without adequate compensation, Redis Ltd. announced that it would relicense the optional Redis modules from the GNU Affero General Public License (AGPL) to the Apache License, but subject to an addendum known as the "Commons Clause" that restricts commercial usage. This made the modules source-available and no longer free software. The core Redis software remained under a BSD license, with Redis Ltd. committing to maintaining these terms.

In February 2019, citing confusion over the licensing terms, the Apache License with Commons Clause licensing terms for Redis modules was replaced with the "Redis Source Available License" (RSAL), which explicitly prohibits commercial use of the modules as part of "a database, a caching engine, a stream processing engine, a search engine, an indexing engine or an ML/DL/AI serving engine." The last revision of the modules under a free and open source license were forked by community members as the GoodFORM project.

In March 2024, Redis Ltd. announced that beginning with version 7.4, the core Redis software would be relicensed under the RSAL and Server Side Public License (SSPL), both of which are source-available and non-free. The Linux Foundation subsequently announced that it would fork the last BSD-licensed version of Redis as Valkey. In May 2025, Redis Ltd. announced that it would change the license again to the AGPL beginning on version 8.0, citing that forks had achieved their goal of creating a "level playing field" of differentiated products, and that Redis has achieved "record growth" since the change in license.

## Data Model and Types

Redis maps keys to types of values. Redis supports a number of data types including Strings, JavaScript Object Notation (JSON) documents, Hashes (a collection of fields, each field is a name-value string pair), lists, sets, vector sets, and more. This variety allows developers to model diverse application scenarios directly within Redis, from simple key-value lookups to complex data structures like sorted sets for leaderboards or geospatial indexes.

The Redis Query Engine allows users to use Redis as a document database, a vector database, a secondary index, and a search engine. With Redis Query Engine, users can define indexes for hash and JSON documents, and use a rich query language for vector search, full-text search, geospatial queries, and aggregations. This extends Redis beyond a simple cache into a multi-model data platform, supporting modern applications that require flexible querying capabilities.

## Messaging and Transactions

Redis Pub/Sub (short for publish/subscribe) is a lightweight messaging capability. Publishers send messages to a channel, and subscribers receive messages from that channel. This pattern is commonly used for real-time notifications, chat systems, and event-driven architectures where decoupled components need to communicate asynchronously.

A Redis transaction allows the execution of a group of commands in a single step. A request sent by another client will never be served during the execution of a transaction. This guarantees that the commands are executed as a single isolated operation. Redis transactions are based on a queue-and-execute model, where commands are queued and then executed sequentially without interruption, ensuring atomicity for the batch.

Redis users can also upload and execute Lua scripts on the server. This feature enables complex operations to be performed atomically on the server side, reducing network round-trips and ensuring consistency. Lua scripting is particularly useful for implementing custom business logic that must run close to the data.

## Persistence and Durability

Redis typically holds the whole dataset in memory. Versions up to 2.4 could be configured to use what they refer to as virtual memory in which some of the dataset is stored on disk, but this feature is deprecated. Persistence in Redis can be achieved through two different methods: snapshotting, where the dataset is asynchronously transferred from memory to disk at regular intervals as a binary dump, using the Redis RDB Dump File Format; or journaling, where a record of each operation that modifies the dataset is added to an append-only file (AOF) in a background process. Redis can rewrite the append-only file in the background to compact it and reduce recovery time.

The Redis implementation uses the fork system call to duplicate the process holding the data. This allows the parent process to continue serving clients while the child process persists the in-memory data to disk. This design minimizes downtime during persistence operations and is a key factor in Redis's ability to maintain high availability while ensuring data durability.

## Differences from Other Database Systems

Redis is a system that functions as both a data store and a cache. Data is modified and read from the main computer memory while also being persisted to disk in a format optimized for sequential access rather than random access. The formatted data is only reconstructed into memory once the system restarts. This approach contrasts with traditional databases that primarily rely on disk-based storage and random access patterns.

Redis uses a data model that differs from relational database management system (RDBMS). Commands specify operations on abstract data types rather than queries to be executed by a database engine. Data is stored in structures designed for direct retrieval. It does not rely on secondary indexes, aggregations, or other features common in traditional RDBMS. This simplicity and focus on in-memory operation make Redis exceptionally fast for specific access patterns, but it also means that complex analytical queries are better suited to other systems.

## Modern Usage and Ecosystem

As of May 1, 2025, for all versions of Redis starting with 8.0, all data types are included in the same package and available under the Redis Source Available License v2. Previously some data types were separate and therefore available under different licenses. This consolidation simplifies deployment and licensing for users, making Redis a more cohesive platform.

Redis has become a foundational component in many technology stacks, often used alongside [cloud providers](https://www.wikiprompt.org/wiki/amazon-web-services) and [major cloud platforms](https://www.wikiprompt.org/wiki/azure) for caching, session management, and real-time analytics. Its low-latency characteristics also make it suitable for [AI](https://www.wikiprompt.org/wiki/artificial-intelligence) and [machine learning](https://www.wikiprompt.org/wiki/machine-learning) applications that require fast data access for model serving or feature stores. The Redis Query Engine's support for vector search aligns with the growing demand for [generative AI](https://www.wikiprompt.org/wiki/generative-ai) and [large language model](https://www.wikiprompt.org/wiki/large-language-model) applications that rely on similarity search over embeddings.

## See Also

- [Machine Learning](https://www.wikiprompt.org/wiki/machine-learning)
- [Generative AI](https://www.wikiprompt.org/wiki/generative-ai)
- [Amazon Web Services](https://www.wikiprompt.org/wiki/amazon-web-services)
- [Microsoft Azure](https://www.wikiprompt.org/wiki/azure)

---
Source: https://www.wikiprompt.org/wiki/redis
License: CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0/)
Last updated: 2026-09-12T22:21:02.790245+00:00
