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 |
Methods
# async del(key) → {Promise.<boolean>}
Delete a specific key.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
string
|
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 |
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
|
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 |
Promise.<boolean>