MCPcopy
hub / github.com/redis/ioredis / execute

Method execute

lib/Script.ts:42–70  ·  view source on GitHub ↗
(container: any, args: any[], options: any, callback?: Callback)

Source from the content-addressed store, hash-verified

40 }
41
42 execute(container: any, args: any[], options: any, callback?: Callback) {
43 if (typeof this.numberOfKeys === "number") {
44 args.unshift(this.numberOfKeys);
45 }
46 if (this.keyPrefix) {
47 options.keyPrefix = this.keyPrefix;
48 }
49 if (this.readOnly) {
50 options.readOnly = true;
51 }
52
53 const evalsha = new this.Command("evalsha", [this.sha, ...args], options);
54
55 evalsha.promise = evalsha.promise.catch((err: Error) => {
56 if (err.message.indexOf("NOSCRIPT") === -1) {
57 throw err;
58 }
59
60 // Resend the same custom evalsha command that gets transformed
61 // to an eval in case it's not loaded yet on the connection.
62 const resend = new this.Command("evalsha", [this.sha, ...args], options);
63
64 const client = container.isPipeline ? container.redis : container;
65 return client.sendCommand(resend);
66 });
67
68 asCallback(evalsha.promise, callback);
69 return container.sendCommand(evalsha);
70 }
71}

Callers 2

constructorMethod · 0.45
connectMethod · 0.45

Calls 1

sendCommandMethod · 0.45

Tested by

no test coverage detected