Registry / testing / cache-manager-memory-store

cache-manager-memory-store

JSON →
library1.1.0jsnpmunverified

Extremely simple in-memory store for node-cache-manager, primarily used for unit testing. Version 1.1.0 is stable with no active release cadence; the built-in memory store in cache-manager already exists, making this package redundant for production use. It only maintains an in-memory object and does not support TTL. Tests exist solely to verify interface compliance.

npm install cache-manager-memory-store
INSTALL
IMPORT
SIG · CACHE-MANAGER-MEMO
C
cache-manager-memory-store
testingjavascriptv1.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import MemoryStore from 'cache-manager-memory-store'
const MemoryStore = require('cache-manager-memory-store')
Package is ESM-only; CommonJS require will fail.
MemoryStore
import MemoryStore from 'cache-manager-memory-store'
import { MemoryStore } from 'cache-manager-memory-store'
No named export; use default import.
cacheManager.caching({ store: MemoryStore })
import cacheManager from 'cache-manager'; import MemoryStore from 'cache-manager-memory-store'; cacheManager.caching({ store: MemoryStore })
import cacheManager from 'cache-manager'; import { MemoryStore } from 'cache-manager-memory-store';
MemoryStore is default export, not named.

Shows basic usage: initialize cache with memory store, set and get a value.

import cacheManager from 'cache-manager'; import MemoryStore from 'cache-manager-memory-store'; const cache = cacheManager.caching({ store: MemoryStore }); await cache.set('key', 'value'); const val = await cache.get('key'); console.log(val); // 'value'
Debug
Known issues
gotchaTTL is not supported; setting TTL options will be ignored or may cause unexpected behavior.
fix
Do not rely on TTL; use this store only for testing where TTL is not required.
affects: >=1.0.0
gotchaThis package is redundant: node-cache-manager already has a built-in memory store as default when no store is specified.
fix
Omit the store parameter entirely to use the built-in memory store.
affects: all
deprecatedPackage is ESM-only; CommonJS require() will throw an error.
fix
Use ES module import syntax or migrate to dynamic import().
affects: >=1.0.0
Errors
Common errors & fixes
Must use import to load ES Module: require() of ES Module not supported.
Using CommonJS require() on an ESM-only package.
fix
Change 'const MemoryStore = require(...)' to 'import MemoryStore from ...'
ERR_PACKAGE_PATH_NOT_EXPORTED: Package subpath './package.json' is not defined by "exports"
Attempting to require or import a non-exported subpath.
fix
Import only the main entry point: 'cache-manager-memory-store'
TypeError: MemoryStore is not a constructor
Importing MemoryStore as a named export instead of default.
fix
Use default import: import MemoryStore from 'cache-manager-memory-store'
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies
cache-managerrequiredPeer dependency required to use the store with caching
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
cache-manager-memory-store — npm install cache-manager-memory-store · libregistry