RedisService is a KeyValueService that is backed by a redis database.

const store = new RedisService('redis://127.0.0.1')

Hierarchy

  • RedisService

Implements

Constructors

Methods

  • retrieve gets a value out of the store for you and allows you to cast it's type.

    interface Puppy {
    name: string
    }

    const value = await store.retrieve<Puppy[]>('puppy_list')

    Type Parameters

    • T

    Parameters

    • key: string

    Returns Promise<null | T>

  • setExpiry triggers the value under that key is removed in a certain amount of seconds.

    const oneMinute = 60
    await store.setExpiry('puppy_list', oneMinute)

    Parameters

    • key: string
    • duractionInSeconds: number

    Returns Promise<void>

Generated using TypeDoc