MCPcopy
hub / github.com/redis/node-redis / _executeCommand

Method _executeCommand

packages/client/lib/client/index.ts:1222–1245  ·  view source on GitHub ↗

* @internal

(
    command: Command,
    parser: CommandParser,
    commandOptions: CommandOptions<TYPE_MAPPING> | undefined,
    transformReply: TransformReply | undefined,
  )

Source from the content-addressed store, hash-verified

1220 * @internal
1221 */
1222 async _executeCommand(
1223 command: Command,
1224 parser: CommandParser,
1225 commandOptions: CommandOptions<TYPE_MAPPING> | undefined,
1226 transformReply: TransformReply | undefined,
1227 ) {
1228 const csc = this._self.#clientSideCache;
1229 const defaultTypeMapping = this._self.#options.commandOptions === commandOptions ||
1230 (this._self.#options.commandOptions?.typeMapping === commandOptions?.typeMapping);
1231
1232 const fn = () => { return this.sendCommand(parser.redisArgs, commandOptions) };
1233
1234 if (csc && command.CACHEABLE && defaultTypeMapping) {
1235 return await csc.handleCache(this._self, parser as BasicCommandParser, fn, transformReply, commandOptions?.typeMapping);
1236 } else {
1237 const reply = await fn();
1238
1239 const finalReply = transformReply ? transformReply(reply, parser.preserve, commandOptions?.typeMapping) : reply;
1240
1241 publish(CHANNELS.COMMAND_REPLY, () => ({ args: sanitizeArgs(parser.redisArgs), reply: finalReply, clientId: this._self._clientId }));
1242
1243 return finalReply;
1244 }
1245 }
1246
1247 /**
1248 * @internal

Callers 12

#createCommandMethod · 0.80
#createModuleCommandMethod · 0.80
#createCommandMethod · 0.80
#createModuleCommandMethod · 0.80
createCommandFunction · 0.80
createFunctionCommandFunction · 0.80
createModuleCommandFunction · 0.80
#createCommandMethod · 0.80
#createModuleCommandMethod · 0.80

Calls 4

publishFunction · 0.90
sanitizeArgsFunction · 0.90
handleCacheMethod · 0.80
transformReplyFunction · 0.50

Tested by

no test coverage detected