chore: reorganize docs apps (#7228)

* reorganize docs apps

* add README

* fix directory

* add condition for old docs
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-05-03 17:36:38 +03:00
1 parent 224ebb2154
commit 4fe28f5a95
6187 files changed
+601447 -598226

No files matched your search

@@ -0,0 +1,71 @@
import { Table } from "docs-ui"
export const metadata = {
title: `In-Memory Cache Module`,
}
# {metadata.title}
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](../redis/page.mdx).
---
## Install the In-Memory Cache Module
To install the In-Memory Cache Module, run the following command in the directory of your Medusa application:
```bash npm2yarn
npm install @medusajs/cache-inmemory
```
Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
```js title="medusa-config.js"
module.exports = {
// ...
modules: {
// ...
cacheService: {
resolve: "@medusajs/cache-inmemory",
options: {
// optional options
},
},
},
}
```
### In-Memory Cache Module Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`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>
@@ -0,0 +1,173 @@
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
<Note type="check">
- [Redis installed and Redis server running](https://redis.io/docs/getting-started/installation/).
</Note>
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 = [
["8", "redisUrl", "The Redis connection URL."]
]
```js title="medusa-config.js" highlights={highlights}
module.exports = {
// ...
modules: {
// ...
cacheService: {
resolve: "@medusajs/cache-redis",
options: {
redisUrl: process.env.CACHE_REDIS_URL,
},
},
},
}
```
### Redis Cache Module Options
<Table>
<Table.Header>
<Table.Row>
<Table.HeaderCell>Option</Table.HeaderCell>
<Table.HeaderCell>Description</Table.HeaderCell>
<Table.HeaderCell>Required</Table.HeaderCell>
<Table.HeaderCell>Default</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>
`redisUrl`
</Table.Cell>
<Table.Cell>
A string indicating the Redis connection URL.
</Table.Cell>
<Table.Cell>
Yes
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`redisOptions`
</Table.Cell>
<Table.Cell>
An object of Redis options. Refer to the [Redis API Reference](https://redis.github.io/ioredis/index.html#RedisOptions) for details on accepted properties.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
\-
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`ttl`
</Table.Cell>
<Table.Cell>
The number of seconds an item can live in the cache before it’s removed.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`30` seconds
</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>
`namespace`
</Table.Cell>
<Table.Cell>
A string used to prefix all cached keys with `{namespace}:`.
</Table.Cell>
<Table.Cell>
No
</Table.Cell>
<Table.Cell>
`medusa`. So, all cached keys are prefixed with `medusa:`.
</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
### Environment Variables
Make sure to add the following environment variables:
```bash
CACHE_REDIS_URL=<YOUR_REDIS_URL>
```
---
## 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
```