mastercache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
1 lines • 1.11 kB
Source Map (JSON)
{"version":3,"sources":["../../../src/types/helpers.ts"],"sourcesContent":["/**\n * A Duration can be a number in milliseconds or a string formatted as a duration\n *\n * Formats accepted are :\n * - Simple number in milliseconds\n * - String formatted as a duration. Uses https://github.com/lukeed/ms under the hood\n */\nexport type Duration = number | string | null | undefined\n\n/**\n * A factory is a function that returns a value or a promise of a value\n */\nexport type MaybePromise<T> = T | Promise<T>\n\n/**\n * A Factory is basically just a function that returns a value\n */\nexport type Factory<T = any> = T | (() => T) | Promise<T> | (() => Promise<T>)\n\nexport type GetSetFactoryOptions = {\n /**\n * Set dynamically the TTL\n * See Adaptive caching documentation for more information\n */\n setTtl: (ttl: Duration) => void\n}\n\n/**\n * GetOrSet Factory\n */\nexport type GetSetFactory<T = any> = (options: GetSetFactoryOptions) => T | Promise<T>\n\n/**\n * Logger interface\n */\nexport type { Logger } from 'typescript-log';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}