Skip to content
doze
0.2

These are the docs for doze 0.2.

What changed in each release →

Valkey

Run Valkey, the open-source Redis, as an in-memory cache any Redis client can use.

On this page

Runs Valkey 8 – 9 · macOS and Linux · registry page ↗

Run a Redis-compatible cache for your app, reached by any Redis client without a code change.

Valkey is the fork of Redis that stayed open source. In March 2024 Redis Inc. moved Redis 7.4 and later to the RSALv2 and SSPLv1 licences, which are not open source; the community forked the last open release, 7.2.4, as Valkey, a BSD-3-Clause project under the Linux Foundation. It speaks the same protocol (RESP), so ioredis, redis-py, go-redis and redis-cli work unchanged.

Valkey keeps its data in memory. For keys that should survive sleep and a restart without living in RAM, use Kvrocks: same protocol, on disk.

module valkey "cache" {
version = 9
maxmemory = "256mb"
}
Terminal window
doze url cache
# redis://cache.shop.doze:6379/0
redis-cli -u "$(doze url cache)" ping

The address is the block’s name in your stack (shop here) on Redis’s port (Names and addresses). Hand it to an app by reference:

app "api" {
run = "go run ./cmd/api"
port = 8080
env = { REDIS_URL = module.cache.url }
}

Larder, the made-up shop in these docs, calls its Valkey redis and passes module.redis.address (host and port, no scheme) to the services whose clients want that form.

module valkey "cache" {
version = 9
password = "cache"
}

The URL then carries it: redis://:cache@cache.shop.doze:6379/0.

With maxmemory set, maxmemory_policy says what goes when it is full, such as "allkeys-lru". To keep keys across a sleep, turn on appendonly = true or set save; or use Kvrocks, which is built for it.

Terminal window
redis-cli -u "$(doze url cache)" info keyspace # how many keys
redis-cli -u "$(doze url cache)" monitor # every command, live
redis-cli -u "$(doze url cache)" flushall # empty it
doze sleep cache # stop it now; it wakes on the next connection

A client that holds its connection open keeps Valkey awake; it sleeps two minutes after the last one closes (Sleep and wake).

A local Valkey server — the open-source Redis fork. Speaks the Redis protocol, so any redis client works. Set a memory ceiling and an eviction policy and use it as a cache; doze boots it on first connect and reaps it when idle.

module valkey "cache" {
version = 9
port = 6379
maxmemory = "256mb"
maxmemory_policy = "allkeys-lru"
appendonly = true
password = "cache"
save = "900 1 300 10"
settings = {
tcp-keepalive = "60"
}
}

The version = you write is the engine’s own version. Declare a series and doze pins its newest published build, or declare an exact build. Either way it is fetched, verified and pinned in doze.lock, so it never moves on its own.

version = pins (today) exact builds
8 8.1.9 20
9 9.1.1 7
Every exact build, per series

8: 8.1.9 · 8.1.8 · 8.1.7 · 8.1.6 · 8.1.5 · 8.1.4 · 8.1.3 · 8.1.2 · 8.1.1 · 8.1.0 · 8.0.9 · 8.0.8 · 8.0.7 · 8.0.6 · 8.0.5 · 8.0.4 · 8.0.3 · 8.0.2 · 8.0.1 · 8.0.0

9: 9.1.1 · 9.1.0 · 9.0.4 · 9.0.3 · 9.0.2 · 9.0.1 · 9.0.0

Field Type Default Description
version number — Engine major to run — 8 or 9. Required.
maxmemory string — Memory ceiling before eviction, e.g. “256mb”.
maxmemory_policy string noeviction Eviction policy (allkeys-lru, volatile-ttl, …).
appendonly bool false Enable the append-only file for durability.
password string — requirepass auth password.
save string — RDB snapshot schedule, e.g. “900 1 300 10” (empty disables).
settings map(string) — Arbitrary valkey.conf directives, applied verbatim.

Every module block also takes doze’s own fields: port, listen, sleep, after, enabled, routes, count and for_each (doze.hcl reference).

The releases of the module that provide this engine. doze picks the newest one that fits your doze and your version =, and pins it in doze.lock; you never write these. Older releases stay available for pinned lockfiles.

Release Engine versions Platforms
0.2.1 8 · 9 3 stable

Signed data: index.yaml ↗ · meta.yaml ↗