@cache-kit/cache-memory
v0.1.1
Published
In-process Map-based CacheProvider for @cache-kit/cache — zero external dependencies, LRU eviction, TTL sweep.
Readme
@cache-kit/cache-memory
In-process, Map-based CacheProvider for
@cache-kit/cache. Zero
external dependencies. LRU eviction, TTL sweep, distributed-lock emulation
for single-process stampede protection.
npm install @cache-kit/cache @cache-kit/cache-memoryimport { Cache } from '@cache-kit/cache';
import { MemoryProvider } from '@cache-kit/cache-memory';
const cache = new Cache({
provider: new MemoryProvider({
type: 'memory',
maxSize: 10_000, // LRU-evict above this many entries
checkIntervalMs: 60_000, // background sweep for expired entries
}),
});Good fit for: single-process apps, local development without a Redis
instance, or as the L1 tier of a MultiLevelProvider in front of a shared
backend.
Not a fit for: multiple app instances that need to share cached data or
coordinate invalidation — use @cache-kit/cache-redis (or another shared
backend) for that.
License
MIT
