Skip to content

cache/cache

Documentation

Overview

Classes

Cache

contains()

Checks if the cache contains a value for the specified key.

ts
static contains(key: string): boolean;
ParameterTypeDescription
keystringThe key to check.

Returns

  • Type: boolean
  • Description: True if the key exists in the cache, false otherwise.

get()

Retrieves the value associated with the specified key from the cache.

ts
static get(key: any): any;
ParameterTypeDescription
keyanyThe key to retrieve.

Returns

  • Type: any
  • Description: The cached value, or `undefined` if the key is not found.

set()

Stores a value in the cache under the specified key. Note: The duration/time-to-live (TTL) is typically configured server-side.

ts
static set(key: string, data: any): void;
ParameterTypeDescription
keystringThe key to store the data under.
dataanyThe data to store.

Returns

  • Type: void
  • Description:

delete()

Removes the key and its associated value from the cache.

ts
static delete(key: string): void;
ParameterTypeDescription
keystringThe key to delete.

Returns

  • Type: void
  • Description:

clear()

Clears all entries from the cache.

ts
static clear(): void;

Returns

  • Type: void
  • Description: