Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UserSessionRedisStorage<MetaData>

User session storage backed by Redis.
This implementation uses core.redis as client and imposes the following requirements to him:
- {@link ConnectionType.SUBSCRIBER} connection needs to be established and available. Key space notification events needs to be enabled on Redis Server side. This is needed for receiving of key space notification events about refresh token keys deletion, expiration or eviction, in order to remove them from list of active user sessions.
- {@link ConnectionType.REGULAR} connection needs to have detect_buffers option enabled, because it stores and reads serialized user session metadata as {@link Buffer} instances.
- {@link RedisClientInstance.db} property should always return a valid db index. It is recommended to not change db after {@link ConnectionType.REGULAR} connection was established.

Type parameters

  • MetaData: UserSessionMetaData<UserSessionDevice, HTTPRequestLocation>

    Type of the user session metadata.

Hierarchy

  • UserSessionRedisStorage

Implements

Constructors

constructor

Methods

delete

  • delete(subject: string, sessionId: string): Promise<void>
  • Parameters

    • subject: string
    • sessionId: string

    Returns Promise<void>

deleteAll

  • deleteAll(subject: string): Promise<number>
  • Parameters

    • subject: string

    Returns Promise<number>

insert

  • insert(subject: string, sessionId: string, metaData: MetaData, ttl: number): Promise<void>
  • Parameters

    • subject: string
    • sessionId: string
    • metaData: MetaData
    • ttl: number

    Returns Promise<void>

read

  • read(subject: string, sessionId: string): Promise<undefined | MetaData>
  • Parameters

    • subject: string
    • sessionId: string

    Returns Promise<undefined | MetaData>

readAll

  • readAll(subject: string): Promise<ReadonlyMap<string, MetaData>>
  • Parameters

    • subject: string

    Returns Promise<ReadonlyMap<string, MetaData>>