Internative Logo

What Is Redis? The In-Memory Data Store for Caching and Real Time

What Is Redis? The In-Memory Data Store for Caching and Real Time

Most applications ask their database the same questions over and over: who is this user, what is in their cart, how many requests have they made this minute. Answering each one from disk is slow and expensive at scale. Redis keeps that kind of data in memory and answers in well under a millisecond, which is why it sits between the application and the main database in so many systems.

This article explains what Redis is, how it works, where it fits, when another tool is the better choice, and what changed with its licence and the Valkey fork.

What is Redis?

Redis is an in-memory data store. It holds data in RAM as keys mapped to data structures, such as strings, hashes, lists, sets and sorted sets, and lets applications read and change them with simple commands over the network. It is used as a cache, a session store, a message broker, a lightweight queue and, for some workloads, as a primary database. The name stands for REmote DIctionary Server.

Salvatore Sanfilippo, known as antirez, started Redis in 2009 to solve a performance problem in his own real-time web analytics startup. He prototyped it in Tcl, rewrote it in C, and published Redis 1.0, the first stable release, in September 2009. VMware and later the company now called Redis (formerly Redis Labs) sponsored its development. Sanfilippo stepped back in 2020 and rejoined the company in November 2024.

The licence story, briefly

Until version 7.2, Redis was released under the permissive BSD 3-Clause licence. On 20 March 2024 the company announced that Redis 7.4 and later would be dual-licensed under the Redis Source Available License (RSALv2) and the Server Side Public License (SSPLv1). Neither is an OSI-approved open-source licence, and the main restriction is on offering Redis as a competing managed service.

About a week later, the Linux Foundation launched Valkey, a BSD-licensed fork of Redis 7.2.4 backed by engineers from Amazon, Google, Alibaba, Ericsson and others. In May 2025 Redis 8 added the OSI-approved AGPLv3 as a third option. For teams using Redis inside their own product, day-to-day use does not change; the differences matter mainly to companies that host or resell it.

How Redis works

Everything lives in memory. Reads and writes go to RAM, not disk, so typical operations complete in microseconds. The trade-off is that the dataset, plus overhead, has to fit in the memory you pay for.

One thread executes commands. Redis runs commands one at a time on a single main thread with an event loop. That makes every individual command atomic and removes a whole class of locking bugs. Network I/O can be spread across extra threads, but a single slow command, such as scanning a huge key, blocks everyone else.

Data structures instead of blobs. Redis understands the structure of the value. You can push to a list, increment a field in a hash, add a score to a sorted set or read a range from a stream without fetching and rewriting the whole object.

Keys can expire. Any key can have a time to live. When memory reaches its limit, an eviction policy, for example least recently used, decides which keys to drop. This is what makes Redis a natural cache.

Persistence is optional. Redis can write point-in-time snapshots (RDB), log every write to an append-only file (AOF), use both, or use neither when it is a pure cache.

Replication and clustering. A primary replicates asynchronously to replicas. Redis Sentinel watches the primary and promotes a replica when it fails, and Redis Cluster splits keys across several primaries for datasets or traffic that outgrow one server.

Key features

  • Rich data types: strings, hashes, lists, sets, sorted sets, bitmaps, HyperLogLog, geospatial indexes and streams.
  • Redis 8 additions: JSON, time series, probabilistic structures, vector sets and the Redis Query Engine, formerly Redis Stack modules, are now in core Redis.
  • Pub/Sub and Streams: fire-and-forget messaging, plus an append-only log with consumer groups for work that must be acknowledged.
  • Atomic operations and scripting: transactions with MULTI/EXEC, and server-side Lua scripts or functions for logic that must run as one step.
  • Vector search for semantic search and retrieval in AI features.

Where Redis is used

  • Caching: storing query results, API responses or rendered fragments in front of PostgreSQL or MongoDB, so the main database handles fewer reads.
  • Sessions and tokens: keeping login state fast and shared across many application servers.
  • Rate limiting and counters: atomic increments with expiry make per-user or per-IP limits straightforward.
  • Background jobs: libraries such as BullMQ for Node.js and Sidekiq for Ruby use Redis as their queue.
  • Real-time features: leaderboards with sorted sets, presence indicators, live notifications through Pub/Sub.

When to choose Redis, and when not to

Choose Redis when:

  • Reads of the same data dominate and a few milliseconds per request matter.
  • You need shared, fast state across several application instances: sessions, counters, locks.
  • The data has a natural expiry, such as tokens, one-time codes or cached pages.
  • You want simple queues or real-time messaging without a separate broker.

Look elsewhere when:

  • Redis would be the only copy of business data that must never be lost. Keep the system of record in a durable database and treat Redis as a fast layer in front of it.
  • The dataset is far larger than the memory you are willing to pay for.
  • You need ad hoc queries, joins or reporting. A relational database does that properly.
  • You need a durable event log that many consumers replay over weeks. Apache Kafka is built for that, and RabbitMQ offers richer routing and delivery guarantees for messaging.

Common operational mistakes: no memory limit or eviction policy, slow commands such as KEYS in production, and forgetting that asynchronous replication means a failover can lose the last few writes.

Redis and its alternatives

OptionWhat it isLicenceBest fit
RedisIn-memory data structure storeRSALv2, SSPLv1 or AGPLv3 (Redis 8+)Caching, real-time features, broad ecosystem
ValkeyLinux Foundation fork of Redis 7.2.4BSD 3-ClauseRedis compatibility under a permissive licence
MemcachedSimple multithreaded key-value cacheBSDPlain caching of strings and blobs
DragonflyRedis- and Memcached-compatible, multithreadedSource-availableVery large single-node in-memory workloads
Managed servicesAmazon ElastiCache, Azure Managed Redis, Google MemorystoreCommercial serviceTeams that do not want to run Redis themselves

The most frequent comparison today is Redis vs Valkey. Valkey is wire-compatible with Redis 7.2, so most clients work with either, and several cloud providers offer it as a managed service. Redis 8 has moved ahead with new data types and built-in modules; if you need those, choose Redis. If a permissive licence and the 7.2 command set are enough, Valkey is a reasonable alternative. Dragonfly takes a different route, using all CPU cores on one machine.

How we use Redis at Internative

We use Redis to improve the performance and scalability of the systems we build. It takes load off the main database, powers real-time features and helps keep applications responsive under high traffic.

Two of our published customer stories run Redis in production:

  • Mesaim, the time and task management portal we built for NewMind.ai, pairs a Node.js and TypeScript backend on PostgreSQL with Redis, behind a Flutter app on AWS.
  • Elra Health, a digital healthcare platform, combines Flutter, .NET, Node.js, Vue.js and WebRTC with MongoDB and Redis on AWS.

If your application is slowing down under load or you are designing one that has to stay fast from the first day, our cloud-based application development team can help you decide where a caching layer belongs.

Frequently asked questions

Is Redis persistent?

It can be. Redis keeps data in memory but can persist it to disk with periodic snapshots (RDB), an append-only log of every write (AOF), or both. With AOF syncing every second, a crash loses at most about a second of writes.

Is Redis free?

Yes, for using it inside your own applications. Redis 8 and later can be used under the AGPLv3 open-source licence or the source-available RSALv2 and SSPLv1. The restrictions mainly affect companies offering Redis as a managed service. Redis Cloud and the company's enterprise software are separate commercial products.

What is the difference between Redis and PostgreSQL?

PostgreSQL is a relational database that stores data on disk, enforces relationships and runs complex SQL queries. Redis keeps data in memory and answers simple key-based operations much faster. They are usually used together: PostgreSQL as the system of record, Redis as the cache and real-time layer in front of it.

What replaced Redis?

Nothing replaced it, but after the 2024 licence change the Linux Foundation started Valkey, a BSD-licensed fork of Redis 7.2.4. Some cloud providers and Linux distributions moved to Valkey, while Redis itself continued with Redis 8 and added the AGPLv3 licence.

Related services

Where this topic becomes an engagement.

Keep reading

The articles that follow this one.