npm.io
2.22.7 • Published 4d ago

@medusajs/cache-inmemory

Licence
MIT
Version
2.22.7
Deps
0
Size
18 kB
Vulns
0
Weekly
0
Stars
36.4K

Medusa logo

@medusajs/cache-inmemory

Documentation | Website

Building blocks for digital commerce

Medusa is released under the MIT license. PRs welcome! Discord Chat Follow @medusajs

In-Memory Cache Module for Medusa: stores cached data in the Node.js process memory, for development and testing. Deprecated since Medusa v2.11.0: use the Caching Module (@medusajs/caching) instead. It ships with @medusajs/medusa and is the default Cache Module when no Redis Cache Module is configured.

At a glance

Package @medusajs/cache-inmemory
Type Infrastructure Module (deprecated)
Module key Modules.CACHE ("cache")
Registered by default Yes
Import from @medusajs/medusa/cache-inmemory

Installation

No installation needed. The module ships with @medusajs/medusa and is registered by default.

Usage

To change its options, register it in medusa-config.ts:

import { defineConfig } from "@medusajs/framework/utils"

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "@medusajs/medusa/cache-inmemory",
      options: {
        ttl: 30,
      },
    },
  ],
})

Configuration

Option Type Description Default
ttl number Time to keep data in the cache, in seconds. 30

Resources