feat: pluggable session cache driver (Redis or in-memory) - #118
Open
nathan-mittelette wants to merge 1 commit into
Open
feat: pluggable session cache driver (Redis or in-memory)#118nathan-mittelette wants to merge 1 commit into
nathan-mittelette wants to merge 1 commit into
Conversation
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
force-pushed
the
feat/memory-session-cache
branch
from
September 4, 2026 12:26
c6c325c to
aa85e93
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 newmemorydriver enables single-instance deployments to keep Tier 2 active without running Redis.Closes #117.
Changes
ISessionCacheinterface (packages/browser/src/session.ts) — extracts the existingSessionCachecontract (connect,save,load,invalidate) so drivers are swappable.MemorySessionCache(packages/browser/src/memory-session.ts) — in-processMapwith TTL-based expiry,prune(), andsizeaccessor. Per-instance only; sessions are not shared across processes.apps/api/src/deps.ts,apps/api/src/config.ts) — newSESSION_CACHE_DRIVERenv var (redisdefault,memoryopt-in).packages/browser/tests/memory-session.test.ts) — save/load, TTL expiry, invalidate, prune, overwrite.session-cache.mdandconfiguration.mdwith the new driver;CHANGELOG.mdentry under[Unreleased].Checklist
main(viafeat/memory-session-cache)bun run verify— run locally before pushing (see note below)CHANGELOG.mdupdated under## [Unreleased]