Я использую клиент ioredis (@4.6.2) с node.js, и мне нужно выполнять много битовых операций (которые не зависят друг от друга). Что-то вроде этого :
import * as ioredis from "ioredis";
...
private readonly client: ioredis.Redis;
this.client = new ioredis("my_url");
...
await this.client.send_command("BITOP", "OR", "a_or_b", "a", "b");
await this.client.send_command("BITOP", "OR", "a_or_c", "a", "c");
await this.client.send_command("BITOP", "OR", "a_or_d", "a", "d");
await this.client.send_command("BITOP", "OR", "a_or_e", "a", "e");
// etc...
С некоторыми другими операциями (такими как setbit
) я могу использовать объект pipeline и его функцию exec()
для атомарного запуска:
const pipeline: Pipeline = this.client.pipeline();
pipeline.setbit(a, 1, 1);
pipeline.setbit(a, 12, 0);
pipeline.setbit(b, 3, 1);
await pipeline.exec();
Но я не могу найти ни pipeline.bitop()
, ни pipeline.send_command()
функции.
Есть ли способ отправить эти BITOP
команды в атомарной операции? Спасибо