* docs: migrate ui docs to docs universe * created yarn workspace * added eslint and tsconfig configurations * fix eslint configurations * fixed eslint configurations * shared tailwind configurations * added shared ui package * added more shared components * migrating more components * made details components shared * move InlineCode component * moved InputText * moved Loading component * Moved Modal component * moved Select components * Moved Tooltip component * moved Search components * moved ColorMode provider * Moved Notification components and providers * used icons package * use UI colors in api-reference * moved Navbar component * used Navbar and Search in UI docs * added Feedback to UI docs * general enhancements * fix color mode * added copy colors file from ui-preset * added features and enhancements to UI docs * move Sidebar component and provider * general fixes and preparations for deployment * update docusaurus version * adjusted versions * fix output directory * remove rootDirectory property * fix yarn.lock * moved code component * added vale for all docs MD and MDX * fix tests * fix vale error * fix deployment errors * change ignore commands * add output directory * fix docs test * general fixes * content fixes * fix announcement script * added changeset * fix vale checks * added nofilter option * fix vale error
66 lines
2.3 KiB
Plaintext
66 lines
2.3 KiB
Plaintext
---
|
||
description: 'In this document, you’ll 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, you’ll 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.'
|
||
}
|
||
}}
|
||
/>
|