Registry / storage / map-cache

map-cache

JSON →
library0.2.2jsnpmunverified

Basic cache object for storing key-value pairs, version 0.2.2. This package provides a simple MapCache class with get, set, has, and del methods, similar to Lo-dash v3 MapCache. It has minimal dependencies and a straightforward API, but is largely obsolete compared to native Map or modern caches like cache-base. Last updated in 2016, it is in maintenance mode with no recent releases.

npm install map-cache
INSTALL
IMPORT
SIG · MAP-CACHE
M
map-cache
storagejavascriptv0.2.2
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.

MapCache
import MapCache from 'map-cache'
const { MapCache } = require('map-cache')
Default export only. Use require('map-cache') for CJS.

Shows basic usage of MapCache: create, set, get, has, and delete entries.

import MapCache from 'map-cache'; const cache = new MapCache(); cache.set('key1', 'value1'); console.log(cache.get('key1')); // 'value1' console.log(cache.has('key1')); // true cache.del('key1'); console.log(cache.has('key1')); // false
Debug
Known issues
gotchaMapCache does not support non-string keys; native Map is preferred for modern code.
fix
Use new Map() for key-value storage, or consider cache-base for more features.
affects: >=0.1.0
deprecatedThis package is essentially a polyfill for MapCache from Lo-dash v3; native Map is available in Node >=0.12.
fix
Replace with new Map() or import from 'lodash' if needed.
affects: >=0.2.0
gotchaThe package uses CommonJS; ES module imports may require bundler support.
fix
Use require('map-cache') or configure bundler for CJS.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'map-cache'
Package not installed or typo in require/import.
fix
Run `npm install map-cache` and ensure correct import path.
TypeError: mapCache.get is not a function
Incorrect instantiation (e.g., forgot `new`).
fix
Use `new MapCache()` to create an instance.
Property 'map' does not exist on type 'MapCache'
TypeScript user trying to use Map methods on MapCache.
fix
MapCache only has get, set, has, del methods; no iteration methods.
Upgrade
Version history
0.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
map-cache — npm install map-cache · libregistry