@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

main
ts 38 lines 1.32 KB
Raw
1 import * as AWS from "@alchemy.run/aws";
2 import * as Context from "effect/Context";
3 import * as Effect from "effect/Effect";
4 import * as Layer from "effect/Layer";
5
6 export class FixtureCache extends Context.Service<
7 FixtureCache,
8 {
9 cache: AWS.ElastiCache.ServerlessCache;
10 }
11 >()("FixtureCache") {}
12
13 /**
14 * The serverless cache shared by the VPC-attached data-plane fixture
15 * (`handler.ts`) and the control-plane snapshot fixture
16 * (`snapshot-handler.ts`). Both Lambdas provide this same layer reference,
17 * so the stack declares a single cache.
18 */
19 export const FixtureCacheLive = Layer.effect(
20 FixtureCache,
21 Effect.gen(function* () {
22 // Valkey is the cheapest engine; usage limits are pinned to the service
23 // minimums (1 GB storage, 1000 ECPUs/s) purely for cost control. Subnets
24 // and security group are left to the API defaults: the account's default
25 // VPC and its DEFAULT security group — the same network the data-plane
26 // fixture Lambda attaches to.
27 const cache = yield* AWS.ElastiCache.ServerlessCache("FixtureCache", {
28 engine: "valkey",
29 description: "alchemy elasticache fixture",
30 cacheUsageLimits: {
31 dataStorage: { maximum: 1 },
32 ecpuPerSecond: { maximum: 1000 },
33 },
34 tags: { fixture: "elasticache-serverless" },
35 });
36 return { cache };
37 }),
38 );