You're viewing archived documentation for @imqueue/rpc v1.17.1. APIs may differ from the current release. View the latest version ↗

RedisCache class

Class RedisCache. Implements cache engine over redis.

Signature:

export declare class RedisCache implements ICache 

Implements: ICache

Properties

Property

Modifiers

Type

Description

name

string

options

IRedisCacheOptions

ready

boolean

Methods

Method

Modifiers

Description

del(key)

Removes stored in cache value under given key

destroy()

static

Safely destroys redis connection

get(key)

Returns value stored in cache by a given key

init(options)

Initializes cache instance

purge(keyMask)

Purges all keys from cache by a given wildcard mask

set(key, value, ttl, nx)

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.