cachu

🦝 Simple, Minimalistic KV Cache

Usage no npm install needed!

<script type="module">
  import cachu from 'https://cdn.skypack.dev/cachu';
</script>

README

cachu

Simple, minimalistic key-value cache, created by Azury.

  • fully asynchronous
  • small n' easy
  • zero dependencies
Make sure to read our 📃 Changelog

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