Redis
Fly.Redis is managed Upstash Redis in a
Fly org. Bind ReadWriteRedis on a
Service. Alchemy writes REDIS_URL as an
App secret and the runtime client uses it internally. Redis is not
reachable from CI — drive it over HTTP.
Create Redis
Section titled “Create Redis”Alchemy generates a unique name unless you pass one. Default
region is iad. Default plan is the
cheapest addOnPlans row (free or pay-as-you-go).
const cache = yield* Fly.Redis("Cache");A stable name
Section titled “A stable name”Pass name when you want a stable Upstash database name.
const cache = yield* Fly.Redis("Cache", { name: "my-cache", primaryRegion: "iad",});Bind from a Service
Section titled “Bind from a Service”Yield Fly.ReadWriteRedis (or ReadRedis / WriteRedis) in
Service init. Provide the matching *Http layer.
import * as HttpServerResponse from "effect/unstable/http/HttpServerResponse";
const Cache = Fly.Redis("Cache");
export default class Api extends Fly.Service<Api>()( "Api", { app: Site, main: import.meta.url, port: 3000 }, Effect.gen(function* () { const cache = yield* Fly.ReadWriteRedis(Cache); return { fetch: Effect.gen(function* () { yield* cache.set("marker", "hello"); const value = yield* cache.get("marker"); return HttpServerResponse.json({ value }); }), }; }).pipe(Effect.provide(Fly.ReadWriteRedisHttp)),) {}Eviction
Section titled “Eviction”Enable eviction for cache workloads. Updated in place.
const cache = yield* Fly.Redis("Cache", { eviction: true,});Read replicas
Section titled “Read replicas”readRegions are extra replica regions. Updated in place. They
must not include the primary region.
const cache = yield* Fly.Redis("Cache", { primaryRegion: "iad", readRegions: ["sjc"],});Omit plan for the cheapest listed plan. Pass a plan id or display
name to pin one. Fixed plans are billed.
const cache = yield* Fly.Redis("Cache", { plan: "Pay-as-you-go",});Where next
Section titled “Where next”Regions lists codes. Default primary is
iad.
Services is the Machine that binds
ReadWriteRedis.
The Redis reference lists every prop.