Options
All
  • Public
  • Public/Protected
  • All
Menu

Abstract base class required for implementing a cache driver.

Hierarchy

Index

Methods

Abstract close

  • close(): Promise<boolean>
  • Closes connection or ends cache timeouts depending on underlying driver.

    Returns Promise<boolean>

Abstract delete

  • delete(keys: string | string[]): Promise<number>
  • Delete a key.

    Parameters

    • keys: string | string[]

    Returns Promise<number>

Abstract expire

  • expire(key: string, ttl: number): Promise<boolean>
  • Sets the expiry duration (in seconds) for a given key.

    Parameters

    • key: string
    • ttl: number

      time-to-live in seconds

    Returns Promise<boolean>

Abstract get

  • get(key: string): Promise<any>
  • Gets the cached value at key.

    Parameters

    • key: string

    Returns Promise<any>

Abstract has

  • has(key: string): Promise<boolean>
  • Gets whether the key exists in cache.

    Parameters

    • key: string

    Returns Promise<boolean>

Abstract keys

  • keys(): Promise<string[]>
  • Lists all keys.

    Returns Promise<string[]>

Abstract set

  • set(key: string, value: any, ttl?: number): Promise<boolean>
  • Sets a value to be cached at key.

    Parameters

    • key: string
    • value: any
    • Optional ttl: number

      time-to-live in seconds

    Returns Promise<boolean>

Abstract ttl

  • ttl(key: string): Promise<number>
  • Gets the time-to-live of the key in seconds.

    Parameters

    • key: string

    Returns Promise<number>

Generated using TypeDoc