Registry / storage / kitten-cache

kitten-cache

JSON →
library0.3.0jsnpmunverified

Simple LRU (Least Recently Used) cache for Node.js. Current version 0.3.0, infrequent updates. Provides basic set/get/has/delete operations with configurable size and optional onRemove callback. No external dependencies. Similar to lru-cache but minimal API.

npm install kitten-cache
INSTALL
IMPORT
SIG · KITTEN-CACHE
K
kitten-cache
storagejavascriptv0.3.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.

Cache
const Cache = require('kitten-cache');
import Cache from 'kitten-cache';
Package uses CommonJS; ES import is not supported.
Cache
const { Cache } = require('kitten-cache');
const { Cache } = require('kitten-cache').default;
Direct named export is not available; the module exports a single constructor function.
Cache
let cache = new (require('kitten-cache'))();
Alternative CommonJS pattern if preferred.

Shows creating a cache instance, setting and getting values, checking existence, and deleting entries.

const Cache = require('kitten-cache'); let cache = new Cache({ size: 100 }); cache.set('key1', 'value1'); cache.set('key2', 42); if (cache.has('key1')) { console.log(cache.get('key1')); // 'value1' } cache.delete('key2'); console.log(cache.get('key2')); // undefined
Debug
Known issues
gotchaCache size is not enforced strictly; the cache may exceed size if items are added quickly.
fix
Monitor cache size manually or use a different library for strict size limits.
affects: <=0.3.0
deprecatedNo support for TTL (time-to-live) expiration.
fix
Use lru-cache or node-cache if TTL is needed.
affects: all
gotchaPackage has no TypeScript type definitions.
fix
Create own .d.ts file or use // @ts-ignore.
affects: all
Errors
Common errors & fixes
Error: Cannot find module 'kitten-cache'
Package not installed.
fix
Run: npm install kitten-cache
TypeError: Cache is not a constructor
Using ES6 import syntax instead of CommonJS require.
fix
Use: const Cache = require('kitten-cache');
cache.get is not a function
Cache instance not created correctly, e.g., calling Cache.get() directly on class.
fix
Instantiate: let cache = new Cache(); then cache.get('key');
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
27 hits · last 30 days
node
26
OpenAI (training)
1
Resources
kitten-cache — npm install kitten-cache · libregistry