Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 359 Bytes

File metadata and controls

23 lines (16 loc) · 359 Bytes

promise-cache

Easily convert time to milliseconds

Examples

import promiseCache from "@turist/promise-cache"

const LRU = require('lru-cache')
const ms = require('ms')

const cache = new LRU({
	max: 100,
	maxAge: ms('5s')
})

const getData = promiseCache(cache, async (args1, args2) => {
	// ... do async stuff

	return something;
})