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

Redis installation and basic data types

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

This article describes the Redis installation and basic data types. Xiaobian thinks it's quite good. Interested friends can refer to it. The details are as follows

Installation 1. Alibaba Cloud CentOS

1. Enter centos system, enter wget, download the latest version of Redis, download process as shown below.

2. Unzip the downloaded file and enter it into the unzipped directory.

3. Enter make to compile.

4. Go to src directory and copy redis-server,redis-benchmark,redis-cli to a directory you created.

5. Set environment variables.

The copy code is as follows: vi /etc/profile

Add export PATH=/usr/local/liuyang/redis:$PATH at the end

Directory needs to be modified to own directory

Enter source /etc/profile

6. Start the Redis service by typing redis-server.

7. Open another terminal and type redis-cli to test it.

2.Windows

1. Go to https://github.com/MSOpenTech/redis/releases

2. Download the zip package and unzip it.

3. Open a console, cd to the unzipped directory, and run redis.server.

4. Open another console and run redis.cli under the decompression directory to perform the basic operations of Redis.

Redis data type

String Add: Add by setting key value.

Get: Get key.

Deletion: Deletion by del key.

2.Add to List:

push key value: Insert an element at the end.

lpush key value: Insert an element into the header. Get:

lrange key 0 -1: 0 represents the first element,-1 represents the penultimate element.

3.Hash

Add: hmset key hashtable

Get: hget key hashtable.key

hgetall key

4. disordered Set

Add: sadd key value1 value2...

Get: smembers sadd

5. Ordered Set

Add: zadd key sortArguments value

sortArgument: Parameter used for sorting

Get:

Positive sequence: zrange key 0 -1

Reverse order: zrevrange key 0 -1

The above is the whole content of this article, I hope the content of this article has a certain reference value for everyone's study or work, if you have questions, you can leave a message to 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

Wechat

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

12
Report