This article is a mirror article of machine translation, please click here to jump to the original article.

View: 11961|Reply: 0

[Redis] Redis queries the type of key and queries according to the type of key

[Copy link]
Posted on 12/30/2015 10:36:19 AM | | | |


First, I got all the stored key values first

127.0.0.1:11311> keys *
1) "/_mwg0k4gpv3eknshhcufcxwld_Internal"
2) "_aaaaaaaa"
3) "/_mwg0k4gpv3eknshhcufcxwld_Data"


Then, I use the get /_mwg0k4gpv3eknshhcufcxwld_Data command to query the data, prompting an error
127.0.0.1:11311> get /_mwg0k4gpv3eknshhcufcxwld_Data
(error) WRONGTYPE Operation against a key holding the wrong kind of value


Although, I don't know what the error means, but I know that there will definitely be data, why is it reported as an error?

Suddenly, I remembered that redis can store multiple data types, it should be that there is a problem with the data type, and then query the data type syntax of key

type yourkey



Then you know the data type, and the data type is hash type, and then query according to the data type, the syntax is as follows:


HGETALL /_mwg0k4gpv3eknshhcufcxwld_Data


Then it was queried:


127.0.0.1:11311> HGETALL /_mwg0k4gpv3eknshhcufcxwld_Data
1) "test"
2) "\x00\x01\x00\x00\x00\xff\xff\xff\xff\x01\x00\x00\x00\x00\x00\x00\x00\x04\x01
\x00\x00\x00\x0cSystem.Int64\x01\x00\x00\x00\am_value\x00\tY\x13+\xcf\x1b\n\x00\
x00\x0b"
3) "id"
4) "\x00\x01\x00\x00\x00\xff\xff\xff\xff\x01\x00\x00\x00\x00\x00\x00\x00\x06\x01
\x00\x00\x000This is stored in Redis Server , time - 10:18:05\x0b"







Previous:"MvcBuildViews" in the element namespace is invalid
Next:Redis Hash Hash Hash Value Problem
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com