m
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
import { RedisService } from './redis.service';
|
||||
export interface LockOptions {
|
||||
ttl?: number;
|
||||
retryDelay?: number;
|
||||
maxRetries?: number;
|
||||
timeout?: number;
|
||||
fallback?: (attempt: number) => Promise<unknown>;
|
||||
}
|
||||
export declare class DistributedLockService {
|
||||
private readonly redisService;
|
||||
private readonly logger;
|
||||
private readonly LOCK_PREFIX;
|
||||
constructor(redisService: RedisService);
|
||||
acquireLock(resource: string, options?: LockOptions): Promise<{
|
||||
success: boolean;
|
||||
identifier?: string;
|
||||
}>;
|
||||
releaseLock(resource: string, identifier: string): Promise<boolean>;
|
||||
renewLock(resource: string, identifier: string, ttl: number): Promise<boolean>;
|
||||
withLock<T>(resource: string, task: () => Promise<T>, options?: LockOptions): Promise<T>;
|
||||
private delay;
|
||||
}
|
||||
Reference in New Issue
Block a user