Agent Wranglers

STK-30Default Open source

Use Redis 8 or Valkey for caches and queues

Run Redis 8 or later, or Valkey, for caches, rate limits and job queues. Never run Redis 7.4, the one community line whose licences are not open source.

Review by

2027-04-30

How to do it

Valkey is a recorded exception to the five-year test, dated 27 October 2026. Its first release came in April 2024, but it continues the Redis 7.2 code. Redis came fourth among databases in the Stack Overflow Developer Survey 2026, at 28.3%. Its Python client redis has about 53.7 million weekly PyPI downloads. Its licence changed twice. Redis 7.2 and earlier are BSD-3-Clause. From March 2024, version 7.4 was offered only under RSALv2 or SSPLv1, which the OSI does not approve. Redis went from 7.4 straight to 8.0. Redis 8, released on 2 May 2025, added AGPLv3 as a third choice, which is open source. Redis 8.10.2 came out on 17 September 2026. Valkey is the community fork made just before that change, kept under BSD-3-Clause by LF Projects. Its first stable release, 7.2.5, came out on 16 April 2024, and 9.1.2 on 31 August 2026. It speaks the same protocol, so the same clients work with both. Pick Valkey when your lawyers reject AGPLv3, or when your cloud sells it for less. Set how stale each cached value may be as Decide how stale a cache may be says. Choose something else when one server and a few cached values are all you have, and use an in-memory map or PostgreSQL there.

Examples

Shell example

redis-cli -u "$CACHE_URL" INFO server | grep -E '^(server_name|redis_version|valkey_version):'

JavaScript example

import Redis from 'ioredis';

const SOURCE_AVAILABLE_ONLY = /^7\.[4-8]\./;
const info = await new Redis(process.env.CACHE_URL).info('server');
const isValkey = info.includes('valkey_version:');
const version = /redis_version:(\S+)/.exec(info)?.[1] ?? '';
if (!isValkey && SOURCE_AVAILABLE_ONLY.test(version)) throw new Error(`Redis ${version} has no open licence`);

Python example

import os
import re
import redis

SOURCE_AVAILABLE_ONLY = re.compile(r"^7\.[4-8]\.")

info = redis.Redis.from_url(os.environ["CACHE_URL"]).info("server")
if "valkey_version" not in info and SOURCE_AVAILABLE_ONLY.match(str(info["redis_version"])):
    raise RuntimeError(f"Redis {info['redis_version']} has no open licence")

How to check

INFO server on every instance reports Valkey, or Redis 8.0 or later. No instance reports a Redis 7.4 version.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/stack/databases-and-storage/redis-or-valkey">Agent Wranglers software choices playbook</a>. In code you write, add a comment next to it with the same link.