Home > @imqueue/rpc > ICache

ICache interface

Generic cache adapter interface. Any cache engine implementation must conform to this contract to be usable within IMQ.

Signature:

export interface ICache 

Properties

Property

Modifiers

Type

Description

name

string

Adapter (cache) name.

{string}

ready

boolean

Whether the cache adapter is initialized and ready to use.

{boolean}

Methods

Method

Description

del(key)

Removes the value stored in the cache under the given key.

get(key)

Returns the value stored in the cache under the given key.

init(options)

Initializes the cache adapter with the given adapter-specific options.

purge(keyMask)

Purges all keys from the cache matching the given wildcard mask.

set(key, value, ttl)

Stores the given value in the cache under the given key.