@geekjuice/cash
v0.0.1
Published
ephemeral local cache
Downloads
2
Readme
cash
ephemeral local cache
install
❯ npm install --global @geekjuice/cash
usage
basic
import { cache } from '@geekjuice/cash';
export default (key: string, ...rest) =>
cached<number>(key, async (): number => expensive(...rest));
custom transform/parse
import { cache } from '@geekjuice/cash';
export default (key: string, ...rest) =>
cached<number>(
key,
async (): number => expensive(...rest),
(to: number): string => `{ "cached": ${to} }`,
(from: string): number => JSON.parse(from).cached
);