UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

41 lines (40 loc) 787 B
/** * @module Lock */ import { TimeSpan } from "../../../../utilities/_module-exports.js"; /** * @internal */ export type ILockState = { expiration: Date | null; }; /** * @internal */ export type ILockStore = Partial<Record<string, ILockState>>; /** * Keeps track of lock states in memory * * @internal */ export declare class LockState { private readonly stateRecord; private readonly key; constructor(stateRecord: ILockStore, key: string); /** * Return the expiration as a TimeSpan. */ get(): TimeSpan | null; /** * Sets the key expiration time. */ set(ttl: TimeSpan | null): void; /** * Checks if the key is expired. */ isExpired(): boolean; /** * Removes the key. */ remove(): void; }