interface GenericRedisCacheContext {
    cacheKeyPrefix: string;
    makeKeyFn: ((...parts: string[]) => string);
    redisClient: IRedis;
    ttlSecondsNegative: number;
    ttlSecondsPositive: number;
}

Properties

cacheKeyPrefix: string

Prefix prepended to all entity cache keys. Useful for adding a short, human-readable distintion for entity keys, e.g. ent-

makeKeyFn: ((...parts: string[]) => string)

Create a key string for key parts (cache key prefix, versions, entity name, etc). Most commonly a simple parts.join(':'). See integration test for example.

redisClient: IRedis

Instance of ioredis.Redis

ttlSecondsNegative: number

TTL for negatively caching database misses. Successive entity loads within this TTL will be assumed not present in the database (unless invalidated).

ttlSecondsPositive: number

TTL for caching database hits. Successive entity loads within this TTL will be read from cache (unless invalidated).