目录搜索
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
文字

HDEL key field [field ...]

自2.0.0起可用。

时间复杂度: O(N)其中 N 是要删除的字段数。

从中存储的哈希中删除指定的字段key。此哈希中不存在的指定字段将被忽略。如果key不存在,则将其视为空散列,并返回此命令0

返回值

整数回复:从散列中删除的字段数量,不包括指定但不存在的字段。

History

  • >= 2.4:接受多个field参数。早于2.4版的 Redis 版本只能删除每个呼叫的字段。

要在早期版本中以原子方式从哈希中删除多个字段,请使用 MULTI / EXEC 块。

例子

redis>  HSET myhash field1 "foo" (integer) 1 

redis>  HDEL myhash field1 (integer) 1 

redis>  HDEL myhash field2 (integer) 0

上一篇:下一篇: