我怎么知道给定键值的数据类型? [英] How do I know the data type of the value of a given key?

查看:69
本文介绍了我怎么知道给定键值的数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我似乎找不到有关Redis命令的有用信息。我想知道给定键值的数据类型。例如,列出我数据库的所有键,我运行以下命令:

I can't seem to find useful information about Redis commands. I want to know the data type of the value of a given key. For instance to list all the keys of my database I run the following command:

 keys *

在我的设置中,我得到以下结果:

In my setup, I get the following result:

 1) "username:testuser:uid"
 2) "uid:1:first"
 3) "uid:1:email"
 4) "uid:1:hash"
 5) "global:next_uid"
 6) "members:email"
 7) "uid:1:username"
 8) "uid:1:last"
 9) "uid:1:salt"
 10) "uid:1:access"
 11) "uid:1:company"
 12) "email:testuser@gmail.com:uid"
 13) "uid:1:phone_number"

如何我知道键 members:email 包含的数据类型吗?我试图运行 get member:email ,但是对键持有错误类型的值却出现错误(error)ERR Operation

How do I know what data type the key members:email contains? I tried to run get members:email but and I get the error (error) ERR Operation against a key holding the wrong kind of value

有什么想法吗?

推荐答案

您可以使用类型命令:
http://redis.io/commands/type

You could use the type command: http://redis.io/commands/type

这篇关于我怎么知道给定键值的数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆