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).
Keeping its data
By default Valkey keeps nothing on disk: a restart, which every change to the
stack is, empties it. Sessions in it sign everybody out, and queued jobs are
gone. VALKEY_PERSISTENCE says what it keeps, in
vallic.yaml or for one environment under
Service settings:
| Value | What it keeps | When it is full |
|---|---|---|
off (the default) |
nothing | evicts the least recently used key |
snapshots |
a snapshot every few minutes, so a restart comes back warm; what was written since the last one is lost | evicts, as a cache does |
store |
every write, synced to disk each second | refuses new writes rather than drop a key (noeviction), whatever VALKEY_MAXMEMORY_POLICY says |
services:
- valkey:
version: '9'
environment:
VALKEY_PERSISTENCE: store
Use store when sessions or queues live in it — Laravel's SESSION_DRIVER
and QUEUE_CONNECTION at redis, Symfony Messenger's Redis transport,
Rails' Action Cable. The data is kept on the machine's own disk, beside the
database. As a store it is in the nightly backup, offsite beside the
database, and restored from the environment's Backups tab; snapshots
keeps a warm cache, which is not backed up. Moved to another machine, a cache
that keeps its data takes it along, either way
(what a move costs); one that
keeps nothing starts empty there. On a machine of its own, a persistent Valkey holds
less than half the machine, so the copy it forks to save has room; beside the
site it counts twice its memory figure for the same copy, and Service settings
does not turn it on where the machine has no room for that
(what each service needs).
From your own computer — a desktop client, a browser — vallic tunnel <env> valkey opens it on 127.0.0.1:6379. See Tunnels.
Versions
| Version | Status |
|---|---|
9.0 |
Supported, and the default |
9.1 |
Supported |
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.
What you can change
In vallic.yaml — what each one does is on Service settings:
services:
- valkey:
version: '9.0'
environment:
VALKEY_MAXMEMORY_POLICY: …
VALKEY_DATABASES: …
VALKEY_PERSISTENCE: …
Anything not on this list refuses the deploy, naming the variable — rather than being accepted and quietly ignored.
Thank you. Good to know it helped.
Thanks — tell us what was missing. Open a ticket from Support in the console, and we answer on the ticket. Open the console