Class

RedisCacheAdapter

RedisCacheAdapter(optionsopt)

Constructor

# new RedisCacheAdapter(optionsopt)

Parameters:
Name Type Attributes Default Description
options Object <optional>
url string <optional>

Redis connection URL (e.g., redis://localhost:6379)

ttl number <optional>
60

Default TTL for keys (seconds)

redisOptions Object <optional>

Additional ioredis options

View Source src/common/cache/adapters/RedisCacheAdapter.js, line 18

Methods

# async close() → {Promise.<boolean>}

Close the Redis connection.

View Source src/common/cache/adapters/RedisCacheAdapter.js, line 106

Promise.<boolean>

# async del(key) → {Promise.<boolean>}

Delete a specific key.

Parameters:
Name Type Description
key string

View Source src/common/cache/adapters/RedisCacheAdapter.js, line 78

Promise.<boolean>

# async get(key, ctxopt) → {Promise.<*>}

Get a value by key, JSON-parse it, and rehydrate into Entity instances (if context provided).

Parameters:
Name Type Attributes Description
key string
ctx Object <optional>
repository Object <optional>

Repository with wrapEntity()

entityClass function <optional>

Entity class constructor

View Source src/common/cache/adapters/RedisCacheAdapter.js, line 31

Promise.<*>

# async invalidatePrefix(prefix) → {Promise.<boolean>}

Invalidate all keys beginning with the prefix. Uses SCAN to avoid blocking Redis on large keyspaces.

Parameters:
Name Type Description
prefix string

View Source src/common/cache/adapters/RedisCacheAdapter.js, line 89

Promise.<boolean>

# async set(key, value, ttlSecondsopt, ctxopt) → {Promise.<boolean>}

Set a value by key, storing JSON. Accepts entities or plain objects/arrays.

Parameters:
Name Type Attributes Description
key string
value *
ttlSeconds number <optional>

Optional TTL override (seconds)

ctx Object <optional>

Unused for Redis adapter

View Source src/common/cache/adapters/RedisCacheAdapter.js, line 61

Promise.<boolean>