0.0.3 • Published 4 years ago

strategy-cache v0.0.3

Weekly downloads
12
License
-
Repository
-
Last release
4 years ago

Strategy Cache

A package for providing caching.

Usage

import { Cache, InMemoryCacheStrategy } from 'strategy-cache'

const cache = new Cache(new InMemoryCacheStrategy())

const key = 'answer'
const ttl = 300
const calculate = () => Promise.resolve(2+2)

const answer = cache.getOrSet(key, ttl, calculate)

See the integration tests for more usage examples.

Strategies

See the doc for other strategies and how to use them.

0.0.3

4 years ago

0.0.2

6 years ago

0.0.1

6 years ago