目录搜索
Clustercluster addslots(集群 槽位)cluster count failure reports(集群计数失败报告)cluster countkeysinslotcluster delslotscluster failovercluster forgetcluster getkeysinslotcluster infocluster keyslot(集群键槽)cluster meetcluster nodes(集群节点)cluster replicate(集群复制)cluster reset(集群重置)cluster saveconfigcluster set config epochcluster setslotcluster slavescluster slotsreadonlyreadwriteConnectionauthechopingquitselectswapdbGeogeoaddgeodistgeohashgeoposgeoradiusgeoradiusbymemberHasheshdelhexistshgethgetallhincrbyhincrbyfloathkeyshlenhmgethmsethscanhsethsetnxhstrlenhvalsHyperLogLogpfaddpfcountpfmergeKeysdeldumpexistsexpireexpireatkeysmigratemoveobjectpersistpexpirepexpireatpttlrandomkeyrenamerenamenxrestorescansorttouchttltypeunlinkwaitListsblpopbrpopbrpoplpushlindexlinsertllenlpoplpushlpushxlrangelremlsetltrimrpoprpoplpushrpushrpushxPub/SubpsubscribepublishpubsubpunsubscribesubscribeunsubscribeScriptingevalevalshascript debugscript existsscript flushscript killscript loadServerbgrewriteaofbgsaveclient getnameclient killclient listclient pauseclient replyclient setnamecommandcommand countcommand getkeyscommand infoconfig getconfig resetstatconfig rewriteconfig setdbsizedebug objectdebug segfaultflushallflushdbinfolastsavemonitorrolesaveshutdownslaveofslowlogtimeSetssaddscardsdiffsdiffstoresintersinterstoresismembersmemberssmovespopsrandmembersremsscansunionsunionstoreSorted SetszaddzcardzcountzincrbyzinterstorezlexcountzrangezrangebylexzrangebyscorezrankzremzremrangebylexzremrangebyrankzremrangebyscorezrevrangezrevrangebylexzrevrangebyscorezrevrankzscanzscorezunionstoreStringsappendbitcountbitfieldbitopbitposdecrdecrbygetgetbitgetrangegetsetincrincrbyincrbyfloatmgetmsetmsetnxpsetexsetsetbitsetexsetnxsetrangestrlenTransactionsdiscardexecmultiunwatchwatch
文字

SREM key member [member ...]

自1.0.0起可用。

时间复杂度: O(N)其中N是要移除的成员的数量。

从存储的集合中删除指定的成员key。指定的成员不是该组的成员将被忽略。如果key不存在,则将其视为空集,并返回此命令0

当存储的值key不是集合时,将返回错误。

返回值

整数回复:从集合中删除的成员数量,不包括不存在的成员。

历史

  • >= 2.4:接受多个member参数。早于2.4版的 Redis 版本只能删除每个呼叫的集合成员。

例子

redis>  SADD myset "one" (integer) 1 

redis>  SADD myset "two" (integer) 1 

redis>  SADD myset "three" (integer) 1 

redis>  SREM myset "one" (integer) 1 

redis>  SREM myset "four" (integer) 0 

redis>  SMEMBERS myset 1) "two" 2) "three"

上一篇:下一篇: