Registry / storage / cache-manager-memcached-store

cache-manager-memcached-store

JSON →
library6.0.1jsnpmunverified

Memcached store for cache-manager v6+. Supports pluggable memcache clients (memcache-pp, memcache-plus). Currently at v6.0.1, active development. Differentiator: allows choosing underlying memcached driver via a 'driver' option, providing flexibility. First-class ESM and CJS support. Requires cache-manager v5+ as peer dependency. Low maintenance burden, used in production by various Node.js apps.

npm install cache-manager-memcached-store
INSTALL
IMPORT
SIG · CACHE-MANAGER-MEMC
C
cache-manager-memcached-store
storagejavascriptv6.0.1
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 memcachedStore from 'cache-manager-memcached-store'
const memcachedStore = require('cache-manager-memcached-store')
ESM default export. In CJS, use `const memcachedStore = require('cache-manager-memcached-store').default` if using ESM-only build; the package provides both ESM and CJS.
Memcache
import Memcache from 'memcache-pp'
import { Memcache } from 'memcache-pp'
memcache-pp exports a default constructor, not a named export.
caching
import { caching } from 'cache-manager'
const caching = require('cache-manager').caching
cache-manager is ESM-only from v5. Named import for the factory function.

Initializes a memcached cache store with driver, sets and gets a value.

import cacheManager from 'cache-manager'; import memcachedStore from 'cache-manager-memcached-store'; import Memcache from 'memcache-pp'; const cache = cacheManager.caching({ store: memcachedStore, driver: Memcache, options: { hosts: [process.env.MEMCACHED_HOST ?? '127.0.0.1:11211'] } }); await cache.set('mykey', 'myvalue'); const value = await cache.get('mykey'); console.log(value); // 'myvalue' await cache.del('mykey');
Debug
Known issues
breakingSwitching underlying memcached library from memcache-plus to memcache-pp as default requires explicit driver configuration to use a different client. v3+ changed API for driver option.
fix
If you were using memcache-plus before, pass `driver: MemcachePlus` from memcache-plus package.
affects: >=3.0.0 <4.0.0
deprecatedThe entire package is deprecated in favor of cache-manager's built-in tiered caching; no new features, only critical fixes.
fix
Consider migrating to cache-manager's native Memcached support if available.
affects: >=6.0.0
gotchaKeys must always be strings; passing non-string keys may cause unpredictable behavior.
fix
Ensure keys are strings; convert numbers or objects using String() or JSON.stringify.
affects: *
gotchaCompression is not enabled by default and must be configured on the underlying driver (e.g., memcache-pp options).
fix
Pass `options: { compression: true }` or similar driver-specific option.
affects: *
Errors
Common errors & fixes
Cannot find module 'cache-manager-memcached-store'
Package not installed or missing dependency.
fix
Run 'npm install cache-manager-memcached-store' and ensure it's in package.json.
store is not a function
Using wrong import: importing the store incorrectly in CJS environment.
fix
Use `const memcachedStore = require('cache-manager-memcached-store').default;` or switch to ESM.
Cannot find module 'memcache-pp'
memcache-pp not installed; required unless using alternative driver.
fix
Run 'npm install memcache-pp' or use a different compatible driver.
The 'driver' option is required
Missing driver option when calling caching() with memcachedStore.
fix
Add `driver: Memcache` (or alternative) to the caching options object.
Upgrade
Version history
6.0.1latest on npm
Audit
Dependencies
cache-managerrequiredpeer dependency - required to provide caching interface
memcache-ppoptionaldefault underlying memcached client; alternative drivers available via configuration
Agent activity
35 hits · last 30 days
node
32
Resources
cache-manager-memcached-store — npm install cache-manager-memcached-store · libregistry