What is Valkey?

In short
Valkey is an open source, in-memory data store that keeps data in RAM and lets applications read and write it very quickly. It works as a key-value store, and it can also act as a cache, a message broker, or a lightweight database. It began as a community fork of Redis and uses a compatible command set.
What Valkey is
Valkey is an open source server that stores data in memory. Memory here means RAM, the fast working memory of a computer. Because of that, reads and writes take very little time. Your application talks to the Valkey server over the network, and the server answers with the data you asked for.
The basic unit of storage is the key. A key is a name, such as user:1001, and each key holds a value. The value can be a plain string, but Valkey also supports richer types such as lists, sets, sorted sets, hashes, and streams. The official documentation describes these in its data types overview, so you can pick the shape that fits your data.
Valkey began as a fork of Redis. A fork is a copy of a project that continues on its own path. Valkey keeps a large part of the Redis command set and protocol, so many existing clients and tools work with it. The migration guide in the documentation lists how to move from Redis and how well the two match.
How it works
Valkey runs as a separate process, usually called the server. Clients connect to it over TCP and send commands in a simple text-based wire format. The server processes each command in order and returns a reply. Because the work happens in memory, the server can handle a large number of requests each second.
Valkey also offers ways to keep data safe across restarts. The persistence options write data to disk in two forms, snapshots and an append-only log. You choose the level of durability that fits your needs. Without persistence, the data lives only in RAM and disappears when the server stops.
Two more features are worth knowing early. Keys can have an expiry time, so Valkey removes them automatically after a set period. Valkey can also be set up with a fixed memory limit and an eviction policy, which removes older or less used keys when memory fills up. This makes it a natural choice for caching.
When to use it
Valkey fits best when you need fast access to data that is read often and changed often. Common uses include:
- Caching results from a slower database or an API.
- Storing session data for web applications.
- Counting events, such as page views or rate limits.
- Passing short messages between services with publish and subscribe.
- Keeping leaderboards with sorted sets.
Valkey is not a replacement for a relational database when you need complex queries, joins, or strict schemas across large amounts of data. Many teams use Valkey next to a primary database rather than instead of it.
A simple example
The command-line tool called valkey-cli lets you try commands directly. The following session stores a value, reads it back, and sets an expiry of 60 seconds:
valkey-cli
127.0.0.1:6379> SET greeting "hello"
OK
127.0.0.1:6379> GET greeting
"hello"
127.0.0.1:6379> EXPIRE greeting 60
(integer) 1
127.0.0.1:6379> TTL greeting
(integer) 57
After 60 seconds, the key is removed automatically. Your application code follows the same pattern, using a client library for its language to send these commands.
Common mistakes
A common mistake is treating Valkey as permanent storage without configuring persistence. If the server restarts and persistence is off, the data is gone. Check the persistence page before you rely on the data.
Another mistake is leaving memory unbounded. Each key uses RAM, so a growing dataset can exhaust the server. Set a memory limit and choose an eviction policy if the server is a cache. The key eviction overview explains the available policies.
Developers also sometimes run slow commands on large collections without thinking about the cost. Because Valkey handles commands one at a time, a slow command delays others. Keep an eye on latency and choose commands that match the size of your data.
Getting started
The installation guide covers Linux, macOS, and Windows. The quick start guide walks through the basic data types. Once you know the basics, the security section explains access control lists, which let you limit which users can run which commands. For larger setups, the replication and cluster pages describe how to add copies of your data and spread it across several servers.
If you are comparing options for caching or fast key-value access, you can also read about how Valkey handles memory and eviction before choosing a deployment plan.
FAQ
Is Valkey the same as Redis?
Valkey started as a fork of Redis and keeps much of its command set and protocol, so many clients work with both. The two projects are separate, and their features may diverge over time. The migration guide in the official documentation lists compatibility details.
Does Valkey save data to disk?
By default Valkey keeps data in memory, but it offers persistence options that write data to disk. You can choose snapshots, an append-only log, or both, depending on how much data loss you can accept after a restart.
Can Valkey be used as a cache?
Yes. You can set a maximum memory size and an eviction policy so that the server removes keys when memory is full. You can also give keys an expiry time so they are removed automatically after a set period.
Do I need to write Valkey commands by hand?
No. Most applications use a client library for their programming language, which sends the commands for you. The valkey-cli tool is useful for testing and troubleshooting, but it is not required for normal application code.
Sources
This page is based on the official documentation below. Read it for full detail.
Valkey — official documentation ↗