You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Medusa Cache is enabled by default for all environments and plans if your Medusa project is running [Medusa v2.11.0 or later](https://github.com/medusajs/medusa/releases/tag/v2.11.0). No configuration is required to start using caching.
32
+
To enable Medusa Cache for your Medusa project deployed on Cloud, set the `caching` feature flag in `medusa-config.ts`:
33
+
34
+
```ts title="medusa-config.ts"
35
+
module.exports=defineConfig({
36
+
// ...
37
+
featureFlags: {
38
+
caching: true
39
+
}
40
+
})
41
+
```
42
+
43
+
This will enable all Medusa Cache functionality in your project.
44
+
45
+
---
46
+
47
+
## How Does Medusa Cache Work?
26
48
27
49
### Cached Data in API Routes
28
50
@@ -38,9 +60,7 @@ By using Medusa Cache, data is cached across several business-critical APIs to b
38
60
39
61
### Integrated into Query
40
62
41
-
{/* Medusa Cache is built on the new [Caching Module](!resources!/infrastructure-modules/caching). The module has been integrated into [Query](!docs!/learn/fundamentals/module-links/query) so that `query.graph` calls can be cached easily. */}
42
-
43
-
Medusa Cache is built on the new [Caching Module](#). The module has been integrated into [Query](!docs!/learn/fundamentals/module-links/query) so that `query.graph` calls can be cached easily.
63
+
Medusa Cache is built on the new [Caching Module](!resources!/infrastructure-modules/caching). The module has been integrated into [Query](!docs!/learn/fundamentals/module-links/query) so that `query.graph` calls can be cached easily.
44
64
45
65
You can enable caching for your custom `query.graph` calls by passing a `cache` option. For example:
46
66
@@ -63,9 +83,7 @@ This code caches the query result. When the same query is made again, the cached
63
83
64
84
By default, data is cached for one hour or until invalidated. Invalidation occurs automatically when related data is created, updated, or deleted.
65
85
66
-
{/* Learn more about automatic invalidation in the [Caching Module documentation](!resources!/infrastructure-modules/caching/concepts#automatic-cache-invalidation). */}
67
-
68
-
Learn more about automatic invalidation in the [Caching Module documentation](#).
86
+
Learn more about automatic invalidation in the [Caching Module documentation](!resources!/infrastructure-modules/caching/concepts#automatic-cache-invalidation).
69
87
70
88
---
71
89
@@ -323,20 +341,3 @@ The following benchmark comparisons demonstrate the performance improvements you
323
341
</Table.Row>
324
342
</Table.Body>
325
343
</Table>
326
-
327
-
---
328
-
329
-
## Opt-Out of Medusa Cache
330
-
331
-
If you want to disable Medusa Cache for your Medusa project, you can do so by disabling the `caching` feature flag in `medusa-config.ts`:
332
-
333
-
```ts title="medusa-config.ts"
334
-
module.exports=defineConfig({
335
-
// ...
336
-
featureFlags: {
337
-
caching: false
338
-
}
339
-
})
340
-
```
341
-
342
-
This will disable all Medusa Cache functionality in your project.
0 commit comments