{"version":3,"sources":["../../../../src/types/options/options.ts"],"sourcesContent":["import type { Duration, Emitter, Logger } from '../main';\n\n/**\n * Options for factory timeouts\n */\nexport type FactoryTimeoutOptions = {\n  /**\n   * The soft timeout. Once this timeout is reached,\n   * the factory will try to return a graced value\n   * if available\n   */\n  soft?: Duration\n\n  /**\n   * The hard timeout. Once this timeout is reached,\n   * the factory will just throw an error that will\n   * bubble up. You will need to handle this error\n   */\n  hard?: Duration\n}\n\n/**\n * Options for Grace periods\n */\nexport type GracePeriodOptions = {\n  /**\n   * Whether to enable grace period\n   */\n  enabled: boolean\n\n  /**\n   * The duration for which entry could still be\n   * served after the TTL has expired\n   */\n  duration?: Duration\n\n  /**\n   * The duration for which the entry will be\n   * reconsidered valid after a failed refresh\n   */\n  fallbackDuration?: Duration\n}\n\n/**\n * These options are common to :\n * - MasterCache global options\n * - Driver options\n * - Core methods\n */\nexport type RawCommonOptions = {\n  timeouts?: FactoryTimeoutOptions\n\n  /**\n   * The duration for which the entry will be\n   * considered valid\n   */\n  ttl?: Duration\n\n  /**\n   * Grace period options\n   */\n  gracePeriod?: GracePeriodOptions\n\n  /**\n   * A percentage of the TTL that will be used\n   * as a threshold for an early refresh\n   */\n  earlyExpiration?: number\n\n  /**\n   * Whether to suppress errors that occur when\n   * trying to fetch from remote (l2) cache\n   */\n  suppressL2Errors?: boolean\n\n  /**\n   * Maximum time for which a lock can try to be acquired\n   * before running a factory\n   */\n  lockTimeout?: Duration\n}\n\n/**\n * Options accepted by Mastercache\n */\nexport type RawMasterCacheOptions = {\n  prefix?: string\n\n  /**\n   * A logger instance that will be used to log\n   * multiple events occurring in the cache\n   *\n   * Pino is compatible out of the box\n   */\n  logger?: Logger\n\n  /**\n   * An emitter instance that will be used to\n   * emit multiple events occurring in the cache\n   *\n   * Emittery and node EventEmitter are compatible\n   * out of the box\n   */\n  emitter?: Emitter\n} & RawCommonOptions\n\n/**\n * The options that can be passed when creating\n * a cache driver like `memoryDriver({ ... })\n */\nexport type CacheDriverOptions = {\n  prefix?: string\n} & RawCommonOptions\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}