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

问题描述

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

当我打电话时:

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

this.redisClient.srem(myKey,entriesToRemove);

我明白了:

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

解决方法

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