Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the console to execute add, delete, modify and search commands to Redis

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Preface

This article mainly introduces the relevant content about the console's execution of the add, delete, modify and search command on Redis, which is shared for your reference and study. Let's take a look at the detailed introduction.

The method is as follows

First of all, it must be to open a console. There are many ways to open the console on the windows system. I like to open the console by using the shortcut "win+R" to open "run" and typing "cmd".

Enter commands in the console

Redis-cli

This will open a Redis prompt

127.0.0.1purl 6379 >

Indicates that the Redis service of ip:127.0.0.1, port: 6379 has been linked.

We can use the "PING" command to check if Redis is working, as follows:

127.0.0.1 6379 > PINGPONG127.0.0.1:6379 >

Indicates that the Redis is operating normally.

If you install it as I did in the previous article and set the password, it will appear as follows:

127.0.0.1 purl 6379 > ping

(error) NOAUTH Authentication required.

It means that you also need to log in with a password. The login command is "AUTH", and my password is set to "admin", as follows:

127.0.0.1 purl 6379 > auth admin

OK

After we have successfully logged in, we can get to the topic.

Redis supports a variety of data types. Here I will briefly introduce the addition, deletion, modification and query of strings. I hope to have the effect of throwing a brick and attracting jade. For various detailed commands, you can query them through the search engine, or take a look at the reference address I have given later.

The string of Redis is a sequence of bytes. Strings are binary safe in Redis, which means they have a known length and are not determined by any special character termination, so they can store anything up to 512 megabytes in length.

Add and modify using the "SET" command

For example, add a data with the key "key001" and the value "val001"

127.0.0.1 purl 6379 > set key001 val001OK

Read using the "GET" command

127.0.1 6379 > get key001 "val001"

Delete using the del command

127.0.0.1 del key001 6379 > get key001 (nil) 127.0.1 > get key001 (nil) 127.0.0.1

In Redis, "(nil)" indicates that the key does not exist.

Summary

The above is the whole content of this article, I hope that the content of this article has a certain reference and learning value for your study or work, if you have any questions, you can leave a message and exchange, thank you for your support.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report