@ima/core
Version:
IMA.js framework for isomorphic javascript application
56 lines • 1.35 kB
TypeScript
import { Storage } from './Storage';
/**
* A specialization of the `link MapStorage` storage mimicking the native
* `WeakMap` using its internal garbage collector used once the size of
* the storage reaches the configured threshold.
*/
export declare class WeakMapStorage<V = object> extends Storage<V> {
/**
* The time-to-live of a storage entry in milliseconds.
*/
private _entryTtl;
/**
* The internal storage of entries.
*/
private _storage;
/**
* Initializes the storage.
*
* @param config Weak map storage configuration. The
* fields have the following meaning:
* - entryTtl The time-to-live of a storage entry in milliseconds.
*/
constructor(config: {
entryTtl: number;
});
/**
* @inheritDoc
*/
has(key: string): boolean;
/**
* @inheritDoc
*/
get(key: string): V | undefined;
/**
* @inheritDoc
*/
set(key: string, value: V): this;
/**
* @inheritDoc
*/
delete(key: string): this;
clear(): this;
/**
* @inheritDoc
*/
keys(): Iterable<string>;
/**
* @inheritDoc
*/
size(): number;
/**
* Deletes all expired entries from this storage.
*/
_discardExpiredEntries(): void;
}
//# sourceMappingURL=WeakMapStorage.d.ts.map