Skip to content

feat: pluggable session cache driver (Redis or in-memory) - #118

Open
nathan-mittelette wants to merge 1 commit into
germondai:mainfrom
nathan-mittelette:feat/memory-session-cache
Open

feat: pluggable session cache driver (Redis or in-memory)#118
nathan-mittelette wants to merge 1 commit into
germondai:mainfrom
nathan-mittelette:feat/memory-session-cache

Conversation

@nathan-mittelette

Copy link
Copy Markdown

Summary

Introduces a pluggable session cache driver so the Tier 2 backend can be selected at startup via SESSION_CACHE_DRIVER. Redis remains the default; a new memory driver enables single-instance deployments to keep Tier 2 active without running Redis.

Closes #117.

Changes

  • ISessionCache interface (packages/browser/src/session.ts) — extracts the existing SessionCache contract (connect, save, load, invalidate) so drivers are swappable.
  • MemorySessionCache (packages/browser/src/memory-session.ts) — in-process Map with TTL-based expiry, prune(), and size accessor. Per-instance only; sessions are not shared across processes.
  • Driver selection (apps/api/src/deps.ts, apps/api/src/config.ts) — new SESSION_CACHE_DRIVER env var (redis default, memory opt-in).
  • Unit tests (packages/browser/tests/memory-session.test.ts) — save/load, TTL expiry, invalidate, prune, overwrite.
  • Docs — updated session-cache.md and configuration.md with the new driver; CHANGELOG.md entry under [Unreleased].

Checklist

  • Branch from main (via feat/memory-session-cache)
  • bun run verify — run locally before pushing (see note below)
  • CHANGELOG.md updated under ## [Unreleased]
  • PR focused on one feature — Docker-related changes excluded

Add SESSION_CACHE_DRIVER env var to select between Redis (default, shared
across instances) and an in-process Map cache (zero dependencies, single-
instance only). Introduces ISessionCache interface for swappable backends.

Closes germondai#117
@nathan-mittelette
nathan-mittelette force-pushed the feat/memory-session-cache branch from c6c325c to aa85e93 Compare September 4, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants