Я использую клиент 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
) я могу использовать объект pipe и его функцию 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
команды в атомарной операции?Спасибо