GithubHelp home page GithubHelp logo

abcdan / cachu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from boywithkeyboard-archive/cachu

0.0 1.0 0.0 2.76 MB

๐Ÿฆ Simple, Minimalistic KV Cache

Home Page: https://npm.im/cachu

License: Apache License 2.0

JavaScript 41.11% TypeScript 58.89%

cachu's Introduction

cachu

npm npm GitHub last commit GitHub issues snyk vulnerabilities

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

Why should you use cachu?

  • fully asynchronous
  • small n' easy
  • zero dependencies

Installation

Install the Package

Install it using your favorite package manager.

npm i cachu
yarn add cachu
pnpm add cachu

Create New Instance

Just create a new instance, it's as easy as that!

import { Cachu } from 'cachu'

const cache = new Cachu({
  maxAmount: 10, // cache can contain up to 10 items
  maxAge: 60 // delete items after a minute
})

const demo = async () => {
  await cache.set(123, 'hello world')
  console.log(await cache.get(123))
}
demo()

API

Configuration

  • maxAge to set the maximum age for each item in the store
  • maxAmount to set the maximum size for the store

Features

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.