Skip to main content

RedisCachePlugin

RedisCachePlugin

This plugin provides a Redis-based RedisCacheStrategy which stores cached items in a Redis instance. This is a high-performance cache strategy which is suitable for production use, and is a drop-in replacement for the DefaultCachePlugin.

Signature
class RedisCachePlugin {
static options: RedisCachePluginInitOptions = {
maxItemSizeInBytes: 128_000,
redisOptions: {},
namespace: 'vendure-cache',
};
init(options: RedisCachePluginInitOptions) => ;
}

options

init

method

RedisCachePluginInitOptions

Configuration options for the RedisCachePlugin.

Signature
interface RedisCachePluginInitOptions {
maxItemSizeInBytes?: number;
namespace?: string;
redisOptions?: import('ioredis').RedisOptions;
}

maxItemSizeInBytes

property
number
default:
128kb

The maximum size of a single cache item in bytes. If a cache item exceeds this size, it will not be stored and an error will be logged.

namespace

property
string
default:
'vendure-cache'

The namespace to use for all keys stored in Redis. This can be useful if you are sharing a Redis instance between multiple applications.

redisOptions

property
import('ioredis').RedisOptions

Options to pass to the ioredis Redis client.