1 import { Table } from "docs-ui"
2
3 export const metadata = {
4 title: `In-Memory Cache Module`,
5 }
6
7 # {metadata.title}
8
9 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.
10
11 This module is helpful for development or when you’re testing out Medusa, but it’s not recommended to be used in production.
12
13 For production, it’s recommended to use modules like [Redis Cache Module](../redis/page.mdx).
14
15 <Note title="Deprecation Notice">
16
17 The In-Memory Cache Module is deprecated starting from [Medusa v2.11.0](https://github.com/medusajs/medusa/releases/tag/v2.11.0). Use the [Caching Module](../../caching/page.mdx) instead.
18
19 </Note>
20
21 ---
22
23 ## Register the In-Memory Cache Module
24
25 <Note>
26
27 The In-Memory Cache Module is registered by default in your application.
28
29 </Note>
30
31 Add the module into the `modules` property of the exported object in `medusa-config.ts`:
32
33 ```ts title="medusa-config.ts"
34 import { Modules } from "@medusajs/framework/utils"
35 // ...
36
37 module.exports = defineConfig({
38 // ...
39 modules: [
40 {
41 resolve: "@medusajs/medusa/cache-inmemory",
42 options: {
43 // optional options
44 },
45 },
46 ],
47 })
48 ```
49
50 ### In-Memory Cache Module Options
51
52 <Table>
53 <Table.Header>
54 <Table.Row>
55 <Table.HeaderCell>
56 Option
57 </Table.HeaderCell>
58 <Table.HeaderCell>
59 Description
60 </Table.HeaderCell>
61 <Table.HeaderCell>
62 Default
63 </Table.HeaderCell>
64 </Table.Row>
65 </Table.Header>
66 <Table.Body>
67 <Table.Row>
68 <Table.Cell>
69
70 `ttl`
71
72 </Table.Cell>
73 <Table.Cell>
74
75 The number of seconds an item can live in the cache before it’s removed.
76
77 </Table.Cell>
78 <Table.Cell>
79
80 `30` seconds
81
82 </Table.Cell>
83 </Table.Row>
84 </Table.Body>
85 </Table>