我正在使用带有 node.js 的 ioredis 客户端(@4.6.2),我需要做很多位操作(它们不依赖于彼此)。像这样的东西:
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
),我可以使用管道对象及其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
在原子操作中发送这些命令?谢谢