Options
All
  • Public
  • Public/Protected
  • All
Menu

A Redis based cache implementation.

Hierarchy

  • RedisCache

Implements

Index

Constructors

constructor

Properties

Protected delAsync

delAsync: any = null

Protected flushdbAsync

flushdbAsync: any = null

Protected getAsync

getAsync: any = null

redis

redis: any = ...

Protected redisClient

redisClient: null | RedisClient = null

Protected setAsync

setAsync: any = null

Methods

flush

  • flush(): Promise<boolean>
  • Removes all entries.

    Returns Promise<boolean>

    The promise that indicates if operation was successful or not.

get

  • get<TResult>(key: string): Promise<TResult>
  • get<TResult, TDefault>(key: string, defaultValue: TDefault): Promise<TResult | TDefault>
  • Tries to return a value from cache by key.

    Type parameters

    • TResult: unknown = any

    Parameters

    • key: string

      The key.

    Returns Promise<TResult>

    The promise with the value or the default value.

  • Type parameters

    • TResult

    • TDefault

    Parameters

    • key: string
    • defaultValue: TDefault

    Returns Promise<TResult | TDefault>

set

  • set(key: string, value: any, ttl?: number | false): Promise<boolean>
  • Sets or deletes a value.

    Parameters

    • key: string

      The key.

    • value: any

      The (new) value. A value of (null) or (undefined) will delete the value of a key.

    • ttl: number | false = 3600

    Returns Promise<boolean>

    The promise, that indicates if operation was successful or not.

Generated using TypeDoc