@apiratorjs/locking-redis
Version:
An extension to the core @apiratorjs/locking library, providing Redis-based implementations of distributed mutexes and semaphores for true cross-process concurrency control in Node.js.
22 lines • 869 B
TypeScript
import { RedisClientType } from "redis";
export type RedisScriptReply = Awaited<ReturnType<RedisClientType["eval"]>>;
export interface IRedisScriptOptions {
keys?: string[];
arguments?: string[];
}
/**
* A Lua script kept in the server-side script cache and invoked by its SHA1,
* so the source is not sent on every call.
*
* Falls back to EVAL whenever the server does not know the script - a fresh
* server, SCRIPT FLUSH, a restart, a failover, or another node of a cluster.
* That fallback re-populates the cache, so the next call is an EVALSHA again.
*/
export declare class RedisScript {
private readonly source;
readonly sha1: string;
constructor(source: string);
run(client: RedisClientType, options?: IRedisScriptOptions): Promise<RedisScriptReply>;
private static isNoScriptError;
}
//# sourceMappingURL=redis-script.d.ts.map