在 ioredis 中使用 SREM 删除多个条目?

Removing multiple entries using SREM in ioredis?

我想知道使用 SREM 命令删除多个条目的正确语法是什么。

当我打电话时:

const myKey = "myKey";
const entriesToRemove: string[] = ...

this.redisClient.srem(myKey, entriesToRemove);

我得到:

ReplyError: ERR wrong number of arguments for 'srem' command

原来entriesToRemove有时是空的。添加长度检查解决了这个问题。