@snap/camera-kit
Version:
Camera Kit Web
22 lines • 1.06 kB
TypeScript
import type { Persistence, ValidKey } from "./Persistence";
/**
* Create a Persistence that will remove entries after they expire.
*
* An expiration function must be provided, which is called each time a value is stored. It must return the expiration
* time for that value, given in seconds from now. For example, to expire a value 24 hours after it is stored, the
* expiration function should return 86400 (the number of seconds in 24 hours).
*/
export declare class ExpiringPersistence<T> implements Persistence<T> {
private readonly expiration;
private readonly persistence;
constructor(expiration: (value: T) => number, persistence: Persistence<[number, T]>);
get size(): number;
retrieve(key: ValidKey): Promise<T | undefined>;
retrieveAll(): Promise<Array<[ValidKey, T]>>;
remove(key: ValidKey): Promise<void>;
removeAll(): Promise<T[]>;
removeExpired(): Promise<void>;
store(value: T): Promise<ValidKey>;
store(key: ValidKey, value: T): Promise<ValidKey>;
}
//# sourceMappingURL=ExpiringPersistence.d.ts.map