mastercache
Version:
Multi-tier cache module for Node.js. Redis, Upstash, CloudfareKV, File, in-memory and others drivers
93 lines (90 loc) • 2.64 kB
TypeScript
import { Duration } from '../../types/helpers.js';
import { RawCommonOptions } from '../../types/options/options.js';
import 'typescript-log';
import '../../../events-CkqPK7En.js';
import '../../types/bus.js';
import '@boringnode/bus/types/main';
declare class CacheEntryOptions {
#private;
/**
* Unique identifier that will be used when logging
* debug information.
*/
id: string;
/**
* Logical TTL is when the value is considered expired
* but still can be in the cache ( Grace period )
*/
logicalTtl?: number;
/**
* Physical TTL is the time when value will be automatically
* removed from the cache. This is the Grace period
* duration
*/
physicalTtl?: number;
/**
* Early expiration TTL is when the value should be
* refreshed in the background.
*/
earlyExpireTtl?: number;
/**
* Timeouts for the cache operations
*/
timeouts?: {
soft?: number;
hard?: number;
};
/**
* Resolved grace period options
*/
gracePeriod: {
enabled: false;
} | {
enabled: true;
duration?: number;
fallbackDuration?: number;
};
/**
* Max time to wait for the lock to be acquired
*/
lockTimeout?: number;
constructor(options?: RawCommonOptions, defaults?: Partial<RawCommonOptions>);
/**
* Returns a new instance of `CacheItemOptions` with the same
* options as the current instance, but with any provided
* options overriding the current
*
* For performance reasons, if no options are provided, the
* current instance is returned
*/
cloneWith(options?: Partial<RawCommonOptions>): CacheEntryOptions;
get isGracePeriodEnabled(): boolean | undefined;
get suppressL2Errors(): boolean | undefined;
/**
* Set a new logical TTL
*/
setLogicalTtl(ttl: Duration): this;
/**
* Compute the logical TTL timestamp from now
*/
logicalTtlFromNow(): number | undefined;
/**
* Compute the physical TTL timestamp from now
*/
physicalTtlFromNow(): number | undefined;
/**
* Compute the early expiration TTL timestamp from now
*/
earlyExpireTtlFromNow(): number | undefined;
/**
* Compute the lock timeout we should use for the
* factory
*/
factoryTimeout(hasFallbackValue: boolean): number | undefined;
/**
* Compute the maximum time we should wait for the
* lock to be acquired
*/
getApplicableLockTimeout(hasFallbackValue: boolean): number | undefined;
}
export { CacheEntryOptions };