www/apps/resources/app/infrastructure-modules/cache/in-memory/page.mdx
import { Table } from "docs-ui"
export const metadata = {
title: In-Memory Cache Module,
}
The In-Memory Cache Module uses a plain JavaScript Map object to store the cached data. This module is used by default in your Medusa application.
This module is helpful for development or when you’re testing out Medusa, but it’s not recommended to be used in production.
For production, it’s recommended to use modules like Redis Cache Module.
<Note title="Deprecation Notice">The In-Memory Cache Module is deprecated starting from Medusa v2.11.0. Use the Caching Module instead.
</Note>The In-Memory Cache Module is registered by default in your application.
</Note>Add the module into the modules property of the exported object in medusa-config.ts:
import { Modules } from "@medusajs/framework/utils"
// ...
module.exports = defineConfig({
// ...
modules: [
{
resolve: "@medusajs/medusa/cache-inmemory",
options: {
// optional options
},
},
],
})
`ttl`
</Table.Cell>
<Table.Cell>
The number of seconds an item can live in the cache before it’s removed.
</Table.Cell>
<Table.Cell>
`30` seconds
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>