@taystack/lru-async

0.0.1 • Public • Published

LRU Cache

LRU cache for async functions using primitive arguments.

Installation

yarn add @taystack/lru-async

Basic usage

The API for this was inspired by lodash debounce and throttle method wrappers.

// async/getUser.ts
import lruasync from '@taystack/lru-async'
import { getDog, Dog } from 'my-async-functions'

const fetchDog: Promise<Dog> = (breed: string) fetch(`/Dogs/${breed}`).then((res) => res.json())

const getDog = lruasync(fetchDog, 10)

export getDog
import { getDog } from 'async/getDog'

Readme

Keywords

none

Package Sidebar

Install

npm i @taystack/lru-async

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

49.5 kB

Total Files

18

Last publish

Collaborators

  • taystack