You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Refactor upstream token storage from STRING+SET to HASH with per-field TTL #4279
The current upstream token storage in Redis uses one STRING key per provider per session plus a SET index to track all providers for a session. This can be simplified to a single HASH per session, where each field is a provider name and the value is the JSON token blob. Redis 7.4+ / Valkey 9.0+ support per-field HEXPIRE, allowing independent TTLs on each provider's tokens within the hash.
This refactor would:
Eliminate the session index SET (upstream:idx:{sid}) entirely
Reduce GetAllUpstreamTokens from 2 round trips to 1 (HGETALL instead of SMEMBERS + MGET)
Simplify DeleteUpstreamTokens from N+1 DEL commands to a single DEL
Remove key-string parsing to extract provider names
Net reduction of ~50 lines of code with no interface changes
go-redis v9.18.0 (already in use) supports HExpire
miniredis v2.37.0 (already in use) supports HEXPIRE (seconds precision only)
Current Blocker
AWS ElastiCache supports up to Valkey 8.2 as of March 2026. There is no public timeline for Valkey 9.0 support. Since ToolHive deployments may run on ElastiCache, this refactor cannot ship until ElastiCache offers Valkey 9.0+.
Activity