Skip to content

fix(example): set Redis TTL on session keys using absoluteDuration - #54

Open
frederikprijck wants to merge 1 commit into
mainfrom
fix/redis-store-ttl
Open

fix(example): set Redis TTL on session keys using absoluteDuration#54
frederikprijck wants to merge 1 commit into
mainfrom
fix/redis-store-ttl

Conversation

@frederikprijck

@frederikprijck frederikprijck commented Sep 3, 2026

Copy link
Copy Markdown
Member

Summary

  • set() in the Redis store example had no EX option, so session keys persisted indefinitely even after the SDK considered them expired
  • Compute the remaining TTL as createdAt + absoluteDuration - now so keys expire at the correct wall-clock time regardless of how many times the session is written
  • Apply the same TTL to the logout:sid:<sid> index key
  • Thread absoluteDuration through createRedisSessionStore (defaulting to the SDK's own default of 3 days) so the Redis TTL stays in sync with sessionConfiguration

Without EX, sessions persist indefinitely in Redis even after the SDK
considers them expired. Compute remaining TTL from createdAt +
absoluteDuration - now so keys expire at the correct wall-clock time.
Apply the same TTL to the sid index key. Thread absoluteDuration through
the store factory so the Redis TTL stays in sync with sessionConfiguration.
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