/** * @file Private internals shared by the `cache/ttl/*` stores — the TTL / * prefix / memo-cap defaults, the clock-skew-aware expiry predicate, the * wildcard key matcher, and the LRU insertion-order setter. One owner so the * node store (`./store`, cacache-backed) and the browser store * (`./browser`, adapter-backed) cannot drift on expiry or matching * semantics. Pure helpers over primordials only — no `node:*`, no * `process`, so both stores stay importable from browser bundles. */ import type { TtlCacheEntry } from './types.js'; export declare const DEFAULT_MEMO_MAX_SIZE = 1000; export declare const DEFAULT_PREFIX = "ttl-cache"; export declare const DEFAULT_TTL_MS: number; /** * Create a matcher for a wildcard-capable key pattern against FULL * (prefixed) cache keys. Without a wildcard the pattern is a plain prefix * match; with wildcards the pattern is anchored both ends so `foo*bar` * matches exactly `foobar`. */ export declare function createKeyMatcher(prefix: string, pattern: string): (fullKey: string) => boolean; /** * Check if an entry is expired for the given ttl. Also detects clock skew by * treating a suspiciously far-future `expiresAt` (more than 10 seconds past * the expected `now + ttl` horizon) as expired. */ export declare function isExpiredEntry(entry: TtlCacheEntry, ttl: number): boolean; /** * Set an entry in a memo Map capped at `maxSize`, using the Map's * insertion-order semantics as the LRU list: an existing key is deleted first * so the re-insert moves it to the tail, and when the cap is hit the oldest * entry, the first key in iteration order, is evicted. */ export declare function lruSet(map: Map>, maxSize: number, key: string, entry: TtlCacheEntry): void;