# RedisCache class · @imqueue/rpc

Source: https://imqueue.org/api/rpc/latest/rpc.rediscache/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/rpc 3.5.3 — generated reference, not hand-written

Class RedisCache. Implements a cache engine on top of Redis.

**Signature:**

```typescript
export declare class RedisCache implements ICache 
```
**Implements:** [ICache](https://imqueue.org/api/rpc/latest/rpc.icache/)

## Properties


| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [name](https://imqueue.org/api/rpc/latest/rpc.rediscache.name/) |  | string | This adapter instance's name, `'RedisCache'`. Used as the registry key and as a segment of every cache key. |
| [options](https://imqueue.org/api/rpc/latest/rpc.rediscache.options/) |  | [IRedisCacheOptions](https://imqueue.org/api/rpc/latest/rpc.irediscacheoptions/) | The effective options after merging user input over [DEFAULT\_REDIS\_CACHE\_OPTIONS](https://imqueue.org/api/rpc/latest/rpc.default_redis_cache_options/). |
| [ready](https://imqueue.org/api/rpc/latest/rpc.rediscache.ready/) |  | boolean | True once [RedisCache.init()](https://imqueue.org/api/rpc/latest/rpc.rediscache.init/) has completed successfully. |


## Methods


| Method | Modifiers | Description |
| --- | --- | --- |
| [del(key)](https://imqueue.org/api/rpc/latest/rpc.rediscache.del/) |  | Removes the value stored in the cache under the given key. |
| [destroy()](https://imqueue.org/api/rpc/latest/rpc.rediscache.destroy/) | `static` | Safely destroys the Redis connection. |
| [get(key)](https://imqueue.org/api/rpc/latest/rpc.rediscache.get/) |  | Returns the value stored in the cache under a given key. |
| [init(options)](https://imqueue.org/api/rpc/latest/rpc.rediscache.init/) |  | Initializes the cache instance. The underlying Redis connection is shared between all instances; concurrent initializations share a single connection attempt. |
| [purge(keyMask)](https://imqueue.org/api/rpc/latest/rpc.rediscache.purge/) |  | Purges all keys from the cache matching a given wildcard mask. |
| [set(key, value, ttl, nx)](https://imqueue.org/api/rpc/latest/rpc.rediscache.set/) |  | Stores the given value in the cache under the given key. If TTL is specified, the cached value will expire after the given number of milliseconds. If the NX argument is set to true, the key:value pair is created only if it does not exist yet. The given value can be any JSON-compatible object and will be serialized automatically. |

