The role of--raw parameters in Redis database

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.