cachu
Simple, minimalistic key-value cache, created by Azury.
Why should you use cachu?
- fully asynchronous
- small n' easy
- zero dependencies
🤫 All the upcoming features are listed over here.
Installation
Install the Package
Install it using your favorite package manager.
npm i cachu
yarn add cachu
Class Instance
Recommended if you need multiple caches.
import { Cachu } from 'cachu'
const cache = new Cachu({
maxAmount: 10,
maxAge: 60
})
(async () => {
await cache.set(123, 'hello world')
console.log(await cache.get(123))
})()
Global Instance
Recommended if you need only one cache or want to configure cachu globally.
import cachu, { set, get } from 'cachu'
cachu({
maxAmount: 10,
maxAge: 60
})
(async () => {
await set(123, 'hello world')
console.log(await get(123))
})()
API
Configuration
maxAge
to set the maximum age for each item in the storemaxAmount
to set the maximum size for the storestore
to set the method of storing data
Features