UNPKG

with-simple-caching

Version:

A wrapper that makes it simple to add caching to any function

17 lines (16 loc) 675 B
import { UniDuration } from '@ehmpathy/uni-time'; import { createCache } from 'simple-on-disk-cache'; import { ProcedureInput, VisualogicContext } from 'visualogic'; /** * .what = a utility to make it easier to use on-disk caching * .why = * - embeds best practices of how to serialize and deserialize */ export declare const withSimpleCachingOnDisk: <I, R>(logic: (input: I, context: VisualogicContext) => Promise<R>, options: { procedure: { name: string; version: string | null; }; expiration?: UniDuration | null; directory: ProcedureInput<typeof createCache>['directory']; }) => (input: I, context: VisualogicContext) => Promise<R>;