docs: add documentation for v1.8 (#3669)

This commit is contained in:
Shahed Nasser
2023-04-03 13:50:59 +02:00
committed by GitHub
parent 0cca13779d
commit c6bfad14d8
123 changed files with 7610 additions and 2697 deletions
+65
View File
@@ -0,0 +1,65 @@
---
description: 'In this document, youll learn about Cache Modules in Medusa, how they work, and which modules Medusa provides.'
---
import DocCardList from '@theme/DocCardList';
import DocCard from '@theme/DocCard';
import Icons from '@theme/Icon';
# Cache
In this document, youll learn about Cache Modules in Medusa, how they work, and which modules Medusa provides.
## Overview
Cache is used in Medusa to store the results of computations such as price selection or various tax calculations. The caching layer in Medusa is implemented as a [module](../modules/overview.mdx). This allows you to replace the underlying database/cache store in your project.
Modules are packages that export a service. The main service exported from a cache module has to implement the `ICacheService` interface exported from the `@medusajs/types` package.
During the app startup, the modules loader will load the service into the [dependency injection container](../fundamentals/dependency-injection.md) to be available as `cacheService` to the rest of the commerce application.
---
## Available Modules
Medusa default starter project comes with the in-memory cache module (`@medusajs/cache-inmemory`). In-memory cache uses a plain JS Map object to store data, which is great for testing and development purposes.
For production environments, there is the Redis cache module package (`@medusajs/cache-redis`) that you can install.
<DocCardList colSize={6} items={[
{
type: 'link',
href: '/development/cache/modules/redis',
label: 'Redis Module',
customProps: {
icon: Icons['academic-cap-solid'],
description: 'Learn how to install and use the Redis Module'
}
},
{
type: 'link',
href: '/development/cache/modules/in-memory',
label: 'In-Memory Module',
customProps: {
icon: Icons['academic-cap-solid'],
description: 'Learn how to install and use the In-Memory Module'
}
},
]} />
---
## Custom Development
Developers can create custom cache modules to implement their custom cache logic. The module can be installed and used in any Medusa backend.
<DocCard item={{
type: 'link',
href: '/development/cache/create',
label: 'Create a Cache Module',
customProps: {
icon: Icons['academic-cap-solid'],
description: 'Learn how to create a cache module in Medusa.'
}
}}
/>