npm.io
2.22.7 • Published 4d ago

@medusajs/cache-redis

Licence
MIT
Version
2.22.7
Deps
1
Size
21 kB
Vulns
0
Weekly
0
Stars
37.0K

Medusa logo

@medusajs/cache-redis

Documentation | Website

Building blocks for digital commerce

Medusa is released under the MIT license. PRs welcome! Discord Chat Follow @medusajs

Redis Cache Module for Medusa: stores cached data in Redis. Deprecated since Medusa v2.11.0: use the Caching Module with the Redis Caching Module Provider (@medusajs/caching-redis) instead. It ships with @medusajs/medusa and is registered from @medusajs/medusa/cache-redis.

At a glance

Package @medusajs/cache-redis
Type Infrastructure Module (deprecated)
Module key Modules.CACHE ("cache")
Registered by default No (the In-Memory Cache Module is the default)
Import from @medusajs/medusa/cache-redis

Installation

No installation needed. The module ships with @medusajs/medusa, but you must register it in medusa-config.ts.

Usage

import { defineConfig } from "@medusajs/framework/utils"

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "@medusajs/medusa/cache-redis",
      options: {
        redisUrl: process.env.CACHE_REDIS_URL,
      },
    },
  ],
})

Configuration

Option Type Description Default
redisUrl string Redis connection URL. -
redisOptions RedisOptions (from ioredis) Options passed to the Redis client. -
ttl number Time to keep data in the cache, in seconds. 30
namespace string Prefix added to cache keys. "medusa"

Resources