Skip to main content

initRedis

function initRedis(config: Object)

Initializes a Redis client using the redis package.

Returns: Object

  • Redis client instance.
PARAMETERTYPEOPTIONALDEFAULTDESCRIPTION
configObjectRedis configuration options.
See the official redis package documentation for more details:
config.urlstringRedis connection URL.

Throws:

Will log an error and exit the process if the Redis URL is missing or the connection fails.
See:

const redisClient = initRedis({ url: "redis://localhost:6379" });