Class RedisCacheAdapter<TType>

To utilize the RedisCacheAdapter, you must install the "ioredis" package and supply a string serde, such as SuperJsonSerde.

import { RedisCacheAdapter, SuperJsonSerde } from "@daiso-tech/core";
import Redis from "ioredis";

const client = new Redis("YOUR_REDIS_CONNECTION_STRING");
const serde = new SuperJsonSerde();
const cacheAdapter = new RedisCacheAdapter(client, {
serde,
rootGroup: "@global"
});

Type Parameters

  • TType

Implements

Constructors

Methods

  • The put method replaces a key if the key exists including the ttl value or adds key that do not exists with a given ttl. Returns true if the key where replaced otherwise false is returned. You must provide a ttl value. If null is passed, the item will not expire.

    Parameters

    Returns Promise<boolean>