import { IDisposable } from "../../../../../../base/common/lifecycle.js"; export interface IResourcePoolOptions { /** * Maximum number of idle items to keep in the pool. * When exceeded after a debounce period, excess idle items are disposed. * Defaults to no limit. */ maxIdleSize?: number; /** * Delay in milliseconds before trimming excess idle items. * Allows rapid get/release cycles (e.g. during streaming) without * unnecessary disposal. Defaults to 10 seconds. */ trimIdleDelay?: number; } export declare class ResourcePool implements IDisposable { private readonly _itemFactory; private readonly _options?; private readonly pool; private _trimTimer; private _inUse; get inUse(): ReadonlySet; constructor(_itemFactory: () => T, _options?: IResourcePoolOptions | undefined); get(): T; release(item: T): void; private _scheduleTrim; private _trimIdle; /** * Clear and dispose the items in the pool that are not in use. */ clear(): void; dispose(): void; } /** * A resource pool that supports keyed reuse. On {@link get}, the pool will * prefer returning an idle item that was previously {@link release released} * with the same key. Keys are best-effort hints — multiple items can share a * key and the pool falls back to any idle item when no keyed match is found. */ export declare class KeyedResourcePool implements IDisposable { private readonly _itemFactory; private readonly _options?; private readonly _idle; private readonly _inUse; private readonly _keyToItems; private readonly _itemToKey; private _trimTimer; get inUse(): ReadonlySet; constructor(_itemFactory: () => T, _options?: IResourcePoolOptions | undefined); get(key: string): T; release(item: T, key: string): void; private _scheduleTrim; private _trimIdle; private _removeFromMaps; clear(): void; dispose(): void; } export interface IDisposableReference extends IDisposable { object: T; isStale: () => boolean; }