const { Cache } = require('@daaxar/cache');
const cacheOptions = { expiresAt: 2 };
const cache = Cache(cacheOptions);
const foo = async () => Date.now();
const cacheableFoo = cache(foo);
const promise = cacheableFoo();
promise.then((value) => console.log({ value }));
const { filesystem } = require('../src/repository');
const repository = filesystem({ folder: `${__dirname}/.cache` });
const cache = Cache({
expiresAt: 2, // Expire at 2 seconds. Default is 30 seconds
repository,
});
const { memory } = require('../src/repository');
const repository = memory();
const cache = Cache({
expiresAt: 2,
repository,
});