@medusajs/cache-inmemory
Documentation | Website
Building blocks for digital commerce
In-Memory Cache Module for Medusa: stores cached data in the Node.js process memory, for development and testing. Deprecated since Medusa v2.11.0: use the Caching Module (@medusajs/caching) instead. It ships with @medusajs/medusa and is the default Cache Module when no Redis Cache Module is configured.
At a glance
| Package | @medusajs/cache-inmemory |
| Type | Infrastructure Module (deprecated) |
| Module key | Modules.CACHE ("cache") |
| Registered by default | Yes |
| Import from | @medusajs/medusa/cache-inmemory |
Installation
No installation needed. The module ships with @medusajs/medusa and is registered by default.
Usage
To change its options, register it in medusa-config.ts:
import { defineConfig } from "@medusajs/framework/utils"
module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/cache-inmemory",
options: {
ttl: 30,
},
},
],
})
Configuration
| Option | Type | Description | Default |
|---|---|---|---|
ttl |
number |
Time to keep data in the cache, in seconds. | 30 |