Skip to content

Replace Session Shadow Key With Hash Field #4185

Open

Description

@Dgramada

Currently RedisIndexedSessionRepository and its' reactive equivalent save a shadow key for each session. Redis 7.4 supports hash field expiration, which can benefit this class. The shadow key can be fully replaced with a single new hash field attached to each session.

This brings multiple benefits:

  • lower traffic, less commands sent to Redis
  • there is one key fewer per session, and the id change no longer has a window where the hash is renamed but the shadow key is not
  • in cluster node the shadow key and hash currently land in different slots; with one key this cannot happen
  • non-expiring sessions become a simple HPERSIST command for the new expiration marker field

This can be achieved by creating an interface that has 2 implementations - the hash field variant and the shadow key variant. The repository class can default to the shadow key approach to ensure backwards compatibility and users could opt in for the new approach by turning it on through a setter method.

Would you be interested in me contributing this improvement?

Activity

  1. added
    type: enhancement
    status: waiting-for-triage
    on Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: waiting-for-triagetype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions