What is Valkey

Valkey is a high-performance key-value in-memory database with rich data structures, ideal for caching, message queues, session storage, and more.

Background: Valkey is an open-source fork of Redis (BSD license), maintained by the Linux Foundation community after Redis changed its license. It is fully API-compatible and can be used as a drop-in replacement.

Key Features

Common Use Cases

ScenarioDescriptionData Structure
CachingReduce database load, accelerate hot data readsString / Hash
Session StoreDistributed session management with TTL auto-expiryString / Hash
LeaderboardReal-time ranking with score updates and range queriesSorted Set
Message QueueLightweight task queue with consumer groupsStream / List
Distributed LockMutual exclusion for shared resources across nodesString (SET NX)
CounterReal-time stats for article views, likes, etc.String (INCR)

Architecture Overview

Valkey uses a single-threaded event loop model (I/O threads are optionally multi-threaded). The core architecture includes:

Quick Start

After installation, connect via the command-line client and run basic operations:

bashCopy
$ valkey-cli
127.0.0.1:6379> SET mykey "Hello Valkey"
OK
127.0.0.1:6379> GET mykey
"Hello Valkey"
127.0.0.1:6379> INCR counter
(integer) 1
127.0.0.1:6379> INCR counter
(integer) 2
127.0.0.1:6379> TTL mykey
(integer) -1

Security Notice: By default, Valkey has no password and listens on all network interfaces. In production, always configure requirepass and bind parameters.

Relationship with Redis

Valkey is a direct fork of Redis 7.2, maintaining full command and data format compatibility. Key differences: