Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Type parameters

  • T

    Type of the cache entries.

Hierarchy

  • Cache

Implements

  • CacheInterface<T>

Index

Constructors

Methods

Constructors

  • new Cache<T>(validityTime?: MomentInputObject): Cache<T>
  • Type parameters

    • T

    Parameters

    • Optional validityTime: MomentInputObject

    Returns Cache<T>

Methods

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

    Returns void

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

    Parameters

    • key: undefined | string

      The key of the entry to retrieve.

    Returns undefined | T

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

  • 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(key: undefined | string, entry: T, expirationTime?: number): void
  • Setter of entries in cache.

    Parameters

    • key: undefined | 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

      Copyright Ⓒ 2023 SAP SE or an SAP affiliate company. All rights reserved.

    Returns void