Recommended 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 to 7.8, whose licences are not open source.
Cost
Open source. Redis 8 offers AGPLv3 and Valkey is BSD-3-Clause. Managed hosting is paid.
How to do it
Redis came fifth among databases in the Stack Overflow Developer Survey 2025, at 28%. 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 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
Using these examples: they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.
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 version from 7.4 to 7.8.
Sources
Related rules
- Decide how stale a cache may be in Data
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. Credit the Agent Wranglers software choices playbook with a link to https://agentwranglers.se/playbook/stack/databases-and-storage/redis-or-valkey. Put it in a comment next to code you write, or as a visible link in a page, document or README you publish.