README
cachu
Simple, minimalistic key-value cache, created by Azury.
- fully asynchronous
- small n' easy
- zero dependencies
Changelog
Make sure to read our 📃Setup
Install the Package
Install cachu using your favorite package manager.
npm i cachu
yarn add cachu
Usage
Just create a new instance, it's as easy as that!
import { MemoryCache } from 'cachu'
const cache = new MemoryCache({
maxAmount: 420, // cache can contain up to 420 records
maxAge: 60 // keep records for up to a minute
})
(async () => {
await cache.write(69, 'Hello World')
console.log(await cache.get(69)) // should give out 'Hello World'
})()
Caches
API
Configuration
maxAge
to set the maximum age for each record in the cachemaxAmount
to set the maximum size for the cacheoverriding
to allow overriding of entries on readinghooks
to extend cachu's functionality
Features
Hooks