import { Token } from '../../token.js'; import { custom, customJson, Logger } from '../../util/logging.js'; /** * Adds a short-lived in-memory view to one named {@link TokenCache} entry. * * Repeated {@link ThrottledTokenCache.get} calls avoid disk access until the * throttle interval passes. Call {@link ThrottledTokenCache.refresh} to check * the file immediately. When no valid file entry exists, * {@link ThrottledTokenCache.refresh} returns `undefined` but keeps the previous * in-memory value and its throttle timestamp. */ export declare class ThrottledTokenCache { [custom]: () => string; private logger?; /** Contains the fully qualified runtime type name. */ readonly $type = "nebius.sdk.ThrottledTokenCache"; private readonly name; private readonly cache; private readonly throttleMs; private cachedToken; private nextCheckTs; /** * Creates a cache view for `name`. * * @param throttle Sets the minimum interval between file checks, in * milliseconds. The default is 300,000 milliseconds (five minutes). */ constructor(name: string, cacheFile?: string, throttle?: number, logger?: Logger | undefined); /** Returns a JSON-safe value for logs. */ [customJson](): unknown; /** Returns the current in-memory value without reading the cache file. */ getCached(): Token | undefined; /** Returns a valid token and reads the file only when the memory view is stale. */ get(): Promise; /** Stores a token in the file and in-memory caches. */ set(token: Token): Promise; /** Removes the token from the file and in-memory caches. */ remove(): Promise; /** Removes the cached token if it equals the specified token. */ removeIfEqual(token: Token): Promise; /** * Reads the cache file immediately and returns its current valid token. * * A valid file token replaces the in-memory value and restarts the throttle * interval. An absent or expired file token returns `undefined` without * clearing the previous in-memory value or throttle timestamp. */ refresh(): Promise; } //# sourceMappingURL=throttled_token_cache.d.ts.map