Options
All
  • Public
  • Public/Protected
  • All
Menu

Class EndpointCache

Hierarchy

  • EndpointCache

Index

Constructors

Methods

Constructors

constructor

  • Parameters

    • capacity: number

    Returns EndpointCache

Methods

clear

  • clear(): void
  • Clears the cache.

    Returns void

delete

  • delete(key: string): void
  • Deletes the value for the given key in the cache.

    Parameters

    • key: string

    Returns void

get

  • Returns un-expired endpoints for the given key.

    Parameters

    • key: string

    Returns EndpointWithExpiry[] | undefined

getEndpoint

  • getEndpoint(key: string): string | undefined
  • Returns an un-expired endpoint for the given key.

    Parameters

    • key: string

    Returns string | undefined

has

  • has(key: string): boolean
  • Checks whether the key exists in cache.

    Parameters

    • key: string

    Returns boolean

set

  • set(key: string, endpoints: Endpoint[]): void
  • Stores the endpoints passed for the key in cache. If not defined, uses empty string for the Address in endpoint. If not defined, uses one minute for CachePeriodInMinutes in endpoint. Stores milliseconds elapsed since the UNIX epoch in Expires param based on value provided in CachePeriodInMinutes.

    Parameters

    • key: string
    • endpoints: Endpoint[]

    Returns void