RedisCache.set() method
Stores in cache given value under given key. If TTL is specified, cached value will expire in a given number of milliseconds. If NX argument set to true will create key:value in cache only if it does not exist yet. Given value could be any JSON-compatible object and will be serialized automatically.
Signature:
set(key: string, value: any, ttl?: number, nx?: boolean): Promise<boolean>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
key |
string | |
|
value |
any | |
|
ttl |
number |
(Optional) |
|
nx |
boolean |
(Optional) |
Returns:
Promise<boolean>
{Promise