@mish-tv/cache
`@mish-tv/cache` is a simple cache library that holds a single value in a single instance.
Installation
npm install --save @mish-tv/cache
Simple Usage
import { Cache } from "@mish-tv/cache";
const entityCache = new Cache<Entity>();
const getEntity = () =>
entityCache.get(async () => {
const entity: Entity = await fetch();
return entity;
});
(async () => {
const entity = await getEntity();
})();
Other Usage
const entityCache = new Cache(60000, 1000, entity);
const entityCache = new Cache("infinity");