Recently read the--raw parameters explained on the Redis website with two features:
1. Print data in its original format without displaying additional type information
For example: Use the command to send the method (Redis in use when the command is sent and interactive mode two) to create a key, named Kuyin:number, the value is 1, as follows:
Then, put Kuyin:number plus 1, as follows:
The return value is 2, but you will notice that there is an (integer) in front of it, what is the question? Because the return type of Redis is multi-type, it may be string, array, shaping, etc., so in order to facilitate people to read and distinguish the result type, when REDIS-CLI detects that the standard output is a TTY (terminal), it will show additional information, here is (integer).
When the standard output of a Redis return data is not a TTY, for example, the data is redirected to a pipeline or file, the--raw option is automatically turned on by default, i.e. no additional information is added, as follows:
When our standard output is TTY and do not want to see additional information, you can add--raw parameters when using REDIS-CLI, as in the following example:
2. Display Chinese
Sometimes we need to write data containing Chinese into redis and then look at the data, but see some utf-8 encoded characters instead of the Chinese we write, for example:
This time, you can increase the--raw parameter, to achieve the view of Chinese data,
The role of--raw parameters in Redis database