Options
All
  • Public
  • Public/Protected
  • All
Menu

Representation of a cache to transiently store objects locally for faster access.

template

T

Type parameters

  • T

Hierarchy

  • Cache

Implements

  • CacheInterface<T>

Index

Constructors

Methods

Constructors

constructor

  • new Cache(validityTime?: MomentInputObject): Cache
  • Parameters

    • Optional validityTime: MomentInputObject

    Returns Cache

Methods

clear

  • clear(): void
  • Clear all cached items.

    Returns void

get

  • get(key: string): T | undefined
  • Getter of cached entries.

    Parameters

    • key: string

      The key of the entry to retrieve

    Returns T | undefined

    The corresponding entry to the provided key if it is still valid, returns undefined otherwise

hasKey

  • hasKey(key: string): boolean
  • Specifies whether an entry with a given key is defined in cache.

    Parameters

    • key: string

      The entry's key

    Returns boolean

    boolean A boolean value that indicates whether the entry exists in cache

set

  • set(key: string, entry: T, expirationTime?: number): void
  • Setter of entries in cache.

    Parameters

    • key: string

      The entry's key

    • entry: T

      The entry to cache

    • Optional expirationTime: number

      The time expressed in UTC in which the given entry expires

    Returns void