[英]How to list the data using redis-cli console?
I am able to add & view the key value pairs through my restful API method invocations.我可以通过我宁静的 API 方法调用来添加和查看键值对。
But after adding the key value pairs, when I try to list/ view them using redis-cli console, it is not listing any values.但是在添加键值对之后,当我尝试使用 redis-cli 控制台列出/查看它们时,它没有列出任何值。
As you can notice, in the console, it is listing some junk values for the **keys *** command (after adding new key/value via browser), but when I try to retrieve the key, it is showing up as empty.如您所见,在控制台中,它列出了 **keys *** 命令的一些垃圾值(通过浏览器添加新键/值后),但是当我尝试检索键时,它显示为空.
What could be the reason for this?这可能是什么原因? How to list the values properly in the console?
如何在控制台中正确列出值?
also attaching the restful api method definitions:还附上了宁静的 api 方法定义:
The value you're seeing in the output of KEYS *
is the java-serialized string user
.您在
KEYS *
的 output 中看到的值是 java 序列化字符串user
。
The first two bytes \xac\xed
(hex: 0xACED) is the STREAM_MAGIC
constant.前两个字节
\xac\xed
(hex: 0xACED) 是STREAM_MAGIC
常量。
The next two bytes \x00\x05
(hex: 0x0005) is the STREAM_VERSION
, version of the serialization protocol.接下来的两个字节
\x00\x05
(十六进制:0x0005)是STREAM_VERSION
,序列化协议的版本。
The next byte, t
is 0x74 = TC_STRING
meaning is a string object.下一个字节,
t
是 0x74 = TC_STRING
意思是一个字符串 object。
Finally \x00\x04
is the length of the string.最后
\x00\x04
是字符串的长度。
This protocol is described in the Object Serialization Stream Protocol, in 6.4.2 Terminal Symbols and Constants该协议在 Object 序列化 Stream 协议的6.4.2 终端符号和常量中进行了描述
You probably want to review your code as to why are the strings being java-serialized before reaching Redis.您可能想查看您的代码,了解为什么在到达 Redis 之前要对字符串进行 java 序列化。 Probably it is because of the
h:
that shows in the screenshot.可能是因为
h:
显示在屏幕截图中。
On the meantime, you can do GET "\xac\xed\x00\x05t\x00\x04user"
to inspect the value of your user
key.同时,您可以执行
GET "\xac\xed\x00\x05t\x00\x04user"
来检查user
密钥的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.