hash:
Redis hash是一個string類型的field和value的映射表,hash特別適合用于存儲對象。
Redis 中每個hash可以存儲 232?– 1鍵值對(40多億)。
實例:
127.0.0.1:6379>??HMSET?runoobkey?name?"redis?tutorial"?description?"redis?basic?commands?for?caching"?likes?20 ?visitors?23000 OK 127.0.0.1:6379>??HGETALL?runoobkey 1)?"name" 2)?"redis?tutorial" 3)?"description" 4)?"redis?basic?commands?for?caching" 5)?"likes" 6)?"20" 7)?"visitors" 8)?"23000"
刪除命令:
Hdel命令
Redis Hdel命令用于刪除哈希表key中的一個或多個指定字段,不存在的字段將被忽略。
redis Hdel 命令基本語法如下:
redis?127.0.0.1:6379>?HDEL?KEY_NAME?FIELD1..?FIELDN
返回值:
被成功刪除字段的數量,不包括被忽略的字段。
redis?127.0.0.1:6379>?HSET?myhash?field1?"foo" (integer)?1 redis?127.0.0.1:6379>?HDEL?myhash?field1 (integer)?1 redis?127.0.0.1:6379>?HDEL?myhash?field2 (integer)?0
更多Redis相關知識,請訪問Redis使用教程欄目!
? 版權聲明
文章版權歸作者所有,未經允許請勿轉載。
THE END