@shagital/atomic-lock
Version:
Universal atomic locking with pluggable drivers (Redis, SQLite, File, Memory)
22 lines (21 loc) • 822 B
TypeScript
import { LockDriver, LockInfo } from '../types';
/**
* SQLite driver implementation using better-sqlite3 or similar
*/
export declare class SQLiteLockDriver implements LockDriver {
private config;
private tableName;
constructor(config: {
db: any;
tableName?: string;
});
private initializeTable;
tryAcquire(key: string, lockValue: string, expiryInSeconds: number): Promise<boolean>;
tryAcquireMultiple(keys: string[], lockValue: string, expiryInSeconds: number): Promise<boolean>;
release(key: string, lockValue: string): Promise<boolean>;
releaseMultiple(keys: string[], lockValue: string): Promise<number>;
exists(key: string): Promise<boolean>;
getLockInfo(key: string): Promise<LockInfo | null>;
cleanup(): Promise<void>;
close(): Promise<void>;
}