feat(cache): add build-tag-gated Redis cache backend

Add optional Redis cache support via `go build -tags redis`, following
the same paired-stub pattern as OTel and Tailscale. The Cache[V] interface
is unchanged; Redis and in-memory implementations are injected at startup
without altering usage logic.

- Add RedisCache[V] implementation with JSON serialization, fail-open on errors
- Add gateway_redis.go / gateway_redis_noop.go paired wiring files
- Refactor GroupWriterCache and ContextFileInterceptor to accept injected caches
- Add GOCLAW_REDIS_DSN env var, docker-compose.redis.yml overlay
- Update Dockerfile and GitHub Actions with ENABLE_REDIS build arg
- Add Redis variant to CI matrix (5 variants: latest, otel, tsnet, redis, full)
This commit is contained in:
viettranx committed 2026-03-07 19:27:24 +07:00
1 parent 7ea27c4c16
commit 0d3230b2bf
17 files changed
+464 -61

No files matched your search

+10
View File
@@ -22,18 +22,27 @@ jobs:
- variant: latest
enable_otel: "false"
enable_tsnet: "false"
enable_redis: "false"
suffix: ""
- variant: otel
enable_otel: "true"
enable_tsnet: "false"
enable_redis: "false"
suffix: "-otel"
- variant: tsnet
enable_otel: "false"
enable_tsnet: "true"
enable_redis: "false"
suffix: "-tsnet"
- variant: redis
enable_otel: "false"
enable_tsnet: "false"
enable_redis: "true"
suffix: "-redis"
- variant: full
enable_otel: "true"
enable_tsnet: "true"
enable_redis: "true"
suffix: "-full"
steps:
@@ -75,6 +84,7 @@ jobs:
build-args: |
ENABLE_OTEL=${{ matrix.enable_otel }}
ENABLE_TSNET=${{ matrix.enable_tsnet }}
ENABLE_REDIS=${{ matrix.enable_redis }}
VERSION=${{ github.ref_name }}
cache-from: type=gha,scope=${{ matrix.variant }}
cache-to: type=gha,mode=max,scope=${{ matrix.variant }}