..._redis set删除指定元素">
赞
踩
查询所有key值
127.0.0.1:6379> keys *
1) "_kombu.binding.celery.pidbox"
2) "_kombu.binding.celery"
3) "_kombu.binding.celeryev"
4) "key"
5) "db_number"
6) "myhash"
7) "key1"
8) "data_string"
9) "data_list"
10) "set1"
删除指定key
127.0.0.1:6379> del key
(integer) 1
127.0.0.1:6379> keys *
1) "_kombu.binding.celery.pidbox"
2) "_kombu.binding.celery"
3) "_kombu.binding.celeryev"
4) "db_number"
5) "myhash"
6) "key1"
7) "data_string"
8) "data_list"
9) "set1"
list中删除指定元素
127.0.0.1:6379> lrange data_list 0 10显示指定key的数据
1) "test_function"
2) "rabbitmq"
3) "haha"
4) "redis"
127.0.0.1:6379> lrem data_list 0 test_function#删除值为test_function的字符串
(integer) 1显示指定key的数据
127.0.0.1:6379> lrange data_list 0 10显示指定key的数据
1) "rabbitmq"
2) "haha"
3) "redis"
Hash Key删除键值
127.0.0.1:6379> HGETALL myhash
1) "field1"
2) "Hello"
3) "field2"
4) "World"
127.0.0.1:6379> HDEL myhash field1 hello
(integer) 1
127.0.0.1:6379> HGETALL myhash
1) "field2"
2) "World"
string删除元素
string类型的key在设置数据的时候,就会覆盖之前的数据,所以等效于删除原有的数据了.
127.0.0.1:6379> set data_string republic
OK
127.0.0.1:6379> get data_string
"republic"
127.0.0.1:6379>
set删除元素
127.0.0.1:6379> SMEMBERS set1
1) "mongodb"
2) "redis"
3) "yuchiappleyuchi"
127.0.0.1:6379> SREM set1 yuchiappleyuchi
(integer) 1
127.0.0.1:6379> SMEMBERS set1
1) "mongodb"
2) "redis"
————————————————
版权声明:本文为CSDN博主「徊忆羽菲」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/guo_qiangqiang/article/details/86579478
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。