abstract-cache v1.0.1 provides a common interface for multiple caching strategies, inspired by Catbox. It allows swapping between in-memory, Redis, MongoDB, and other backends via a simple driver configuration. Unlike Catbox, it supports both callback and async/await patterns, and accepts pre-established connections. Clients like abstract-cache-redis and abstract-cache-mongo exist. The built-in in-memory LRU cache is suitable for development only. Release cadence is low; maintenance mode expected.
npm install abstract-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates an in-memory cache client with async/await support, sets and retrieves a string value.
Use a proper adapter like abstract-cache-redis in production.
Set useAwait: true or provide a callback to each method.
Always read the specific strategy's documentation for key format.
Consider newer alternatives like Catbox or keyv.
const client = cache({ useAwait: true }); client.get('key')Provide driver: { name: 'abstract-cache-redis', options: {} }Set useAwait: true or provide a callback as the last argument.