import { Table } from "docs-ui"
export const metadata = {
title: `Redis Cache Module`,
}
# {metadata.title}
The Redis Cache Module uses Redis to cache data in your store. In production, it's recommended to use this module.
---
## Install the Redis Cache Module
- [Redis installed and Redis server running](https://redis.io/docs/getting-started/installation/).
To install Redis Cache Module, run the following command in the directory of your Medusa application:
```bash npm2yarn
npm install @medusajs/cache-redis
```
Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
export const highlights = [
["11", "redisUrl", "The Redis connection URL."]
]
```js title="medusa-config.js" highlights={highlights}
import { Modules } from "@medusajs/utils"
// ...
module.exports = defineConfig({
// ...
modules: {
[Modules.CACHE]: {
resolve: "@medusajs/cache-redis",
options: {
redisUrl: process.env.CACHE_REDIS_URL,
},
},
},
})
```
### Environment Variables
Make sure to add the following environment variables:
```bash
CACHE_REDIS_URL=
```
### Redis Cache Module Options
Option
Description
Required
Default
`redisUrl`
A string indicating the Redis connection URL.
Yes
\-
`redisOptions`
An object of Redis options. Refer to the [Redis API Reference](https://redis.github.io/ioredis/index.html#RedisOptions) for details on accepted properties.
No
\-
`ttl`
The number of seconds an item can live in the cache before it’s removed.
No
`30` seconds
`namespace`
A string used to prefix all cached keys with `{namespace}:`.
No
`medusa`. So, all cached keys are prefixed with `medusa:`.
---
## Test the Module
To test the module, start the Medusa application:
```bash npm2yarn
npm run dev
```
You'll see the following message in the terminal's logs:
```bash noCopy noReport
Connection to Redis in module 'cache-redis' established
```