Cache and sessions
Cache and sessions. Not required for more than one web node — sessions in the database work across machines too — but faster for both.
Valkey is the open-source fork of Redis and speaks the same protocol, so
anything written for Redis — the Drupal redis module, Laravel's redis driver,
any Redis client — works against it unchanged. A stack runs one cache — Valkey,
Redis or Memcached — so naming a
different one replaces it.
Your application finds it at VALKEY_HOST, and at REDIS_HOST as well, since
that is the name most clients look for. The port is 6379 (REDIS_PORT). See
Variables.
How much memory it holds is sized from your machine: most of a cache machine
when it has one to itself, a share of your plan when it sits beside your site.
When it is full it evicts the least recently used key (allkeys-lru). Set
VALKEY_MAXMEMORY_POLICY to noeviction for a store that must not lose keys —
and remember that nothing in it is backed up.
| Version | Status |
|---|---|
9.0 |
Supported, and the default |
8.1 |
Supported |
8.0 |
Supported |
Pin the version, not the build: name 9.0 and the platform matches it to the
current build, so a security rebuild reaches you without anybody editing a
repository.
In vallic.yaml — what each one does is on Service settings:
services:
- valkey:
version: '9.0'
environment:
VALKEY_MAXMEMORY_POLICY: …
VALKEY_DATABASES: …
Anything not on this list refuses the deploy, naming the variable — rather than being accepted and quietly ignored.