nyx Typedoc
    Preparing search index...

    Class DefaultSessionRepository<Types>

    An object for temporal storage of Session instances.

    Type Parameters

    Hierarchy

    • TTLCache<string, Session<unknown, Types>>
      • DefaultSessionRepository

    Implements

    Index
    checkAgeOnGet: boolean
    max: number
    noDisposeOnSet: boolean
    noUpdateTTL: boolean
    size: number

    The total number of items held in the cache at the current moment.

    ttl: number
    updateAgeOnGet: boolean
    • Cancel the timer and stop automatically expiring entries. This allows the process to gracefully exit where Timer.unref() is not available.

      Returns void

    • Clear the cache entirely, throwing away all values.

      Returns void

    • Deletes a key out of the cache. Returns true if the key was deleted, false otherwise.

      Parameters

      • key: string

      Returns boolean

    • Return a generator yielding [key, value] pairs, from soonest expiring to latest expiring. (Items expiring at the same time are walked in insertion order.)

      Returns Generator<[string, Session<unknown, Types>]>

    • Return a value from the cache. If the key is not found, get() will return undefined. This can be confusing when setting values specifically to undefined, as in cache.set(key, undefined). Use cache.has() to determine whether a key is present in the cache at all.

      Type Parameters

      Parameters

      • key: string
      • Optionaloptions: GetOptions

      Returns T | undefined

    • Return the remaining time before an item expires. Returns 0 if the item is not found in the cache or is already expired.

      Parameters

      • key: string

      Returns number

    • Check if a key is in the cache. Will return false if the item is stale, even though it is technically in the cache.

      Parameters

      • key: string

      Returns boolean

    • Return a generator yielding the keys in the cache, from soonest expiring to latest expiring.

      Returns Generator<string>

    • Delete any stale entries. Returns true if anything was removed, false otherwise.

      Returns boolean

    • Add a value to the cache.

      Parameters

      • key: string
      • value: Session
      • Optionaloptions: SetOptions

      Returns this

    • Set the ttl explicitly to a value, defaulting to the TTL set on the ctor

      Parameters

      • key: string
      • Optionalttl: number

      Returns void

    • Return a generator yielding the values in the cache, from soonest expiring to latest expiring.

      Returns Generator<Session<unknown, Types>>