博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[redis] 获得 database, key, value
阅读量:7018 次
发布时间:2019-06-28

本文共 851 字,大约阅读时间需要 2 分钟。

hot3.png

获得 database

The INFO KEYSPACE command can be used to check whether some keys are defined in several databases.

redis 127.0.0.1:6379[1]> info keyspace# Keyspacedb0:keys=1,expires=0db1:keys=1,expires=0

The SELECT command can be used to switch a session to another database.The SELECT command can be used to switch a session to another database.

redis 127.0.0.1:6379> select 1OKredis 127.0.0.1:6379[1]> keys *1) "bar"

获取所有的 key

keys *

*是通配符

获取 key 的 value

因为 redis 有多种数据类型,并且每种类型的取值方法不同,所有首先需要知道 key 存储的 value 类型

You will need to perform for each key a type and depending on the response perform:

  • for "string": get
  • for "hash": hgetall
  • for "list": lrange 0 -1
  • for "set": smembers
  • for "zset": zrange 0 -1 withscores

Keep in mind that for hashes and sorted sets you will be getting the keys/scores and values.

转载于:https://my.oschina.net/xieyunzi/blog/423199

你可能感兴趣的文章
类加载器
查看>>
ubuntu下搭建svn服务器
查看>>
iptables基础知识详解
查看>>
cloud-init 典型应用 - 每天5分钟玩转 OpenStack(174)
查看>>
CentOS5.5上用yum方式安装Cacti
查看>>
Lucene.Net的简单练习
查看>>
不用软件给文件夹加密
查看>>
RK编译出错,manifest为空
查看>>
Linux learn(七)
查看>>
MXNet动手学深度学习笔记:GoogLeNet神经网络实现
查看>>
JMeter性能压力测试
查看>>
1月第3周中国五大顶级域名净增3.6万 美国净减2万
查看>>
10月全球操作系统份额:Windows仍超90% 优势不减
查看>>
php 计算页面执行时间
查看>>
更改Zend Studio/Eclipse的制表Tab缩进为4个空格缩进
查看>>
find 命令使用
查看>>
你的数据安全么?Hadoop再曝安全漏洞| 黑客利用Hadoop Yarn资源管理系统未授权访问漏洞进行攻击...
查看>>
Nacos v0.7.0:对接CMDB,实现基于标签的服务发现能力
查看>>
如何成为软件高手系列之一
查看>>
正则表达式的multiline和dotall模式
查看>>