@medusajs/cache-redis
v2.22.1
Published
Redis Cache Module for Medusa
Keywords
Readme
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" |
