Skip to content

feat(valkeystore): add Valkey-backed Store#180

Open
YimingIsCOLD wants to merge 4 commits into
mainfrom
feat/session-valkeystore
Open

feat(valkeystore): add Valkey-backed Store#180
YimingIsCOLD wants to merge 4 commits into
mainfrom
feat/session-valkeystore

Conversation

@YimingIsCOLD
Copy link
Copy Markdown
Contributor

@YimingIsCOLD YimingIsCOLD commented May 12, 2026

🚀 Summary

Adds session/valkeystore, a Valkey-backed implementation of session.Store for production deployments where session state must outlive a single process. Snapshots are JSON-encoded under a caller-configurable key prefix and expire server-side when their TTL elapses.

✏️ Changes

  • New server/internal/session/valkeystore package implementing Prepare, Commit, and Drop against the valkey-glide/go/v2 client; default key prefix session: (override with WithPrefix).
  • Tests run against a real Valkey container via testcontainers-go (image valkey/valkey:9.0-alpine, latest version supported by AWS ElastiCache). One container per Test<...> function; per-subtest isolation via t.Name()-derived prefixes.
  • TTL-elapsed Prepare test uses polling (50ms TTL, 300ms deadline) instead of an unconditional sleep.
  • CONTRIBUTING.md: clarified that want/got may name top-level multi-value captures when no if-init binding is used; semantic names still required when if-init binds want/got.
  • memstore_test.go: aligned TestStore_Prepare and TestStore_Commit shape with valkeystore_test.go (folded TestStore_TTL into Prepare, mirrored subtest order, renamed locals to the new want/got pattern).

🧪 Test Plan

  • go test ./server/internal/session/... (memstore, valkeystore, and parent session package all pass)
  • go test -race ./server/internal/session/memstore/ (concurrent access subtest)
  • go test -race ./server/internal/session/valkeystore/ (testcontainer-backed)
  • make lint (0 issues)

@YimingIsCOLD YimingIsCOLD self-assigned this May 12, 2026
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.

1 participant