----Basics of Redis Database

Source: Internet
Author: User
Tags redis server

The Redis database is also known as the data structure database because the storage is based on key-value mode.

Where value can be a string (String), a hash (map), a list , a collection (set), and an ordered set (Zset).

Under the Redis installation directory, there is a file redis.confthat stores the basic configuration information for Redis.

By modifying This file, start again with the following command:

Redis-server Redis.conf-path

The configuration information is applied

Use the command:

Redis-cli

will open the Redis client

In this client, the configuration is obtained/modified by the following command:

Config get keyconfig set key value

It is worth noting that the set value in the client is temporary , and the value of set will not be preserved the next time the Redis server restarts.

Some basic operations (add and revise) are as follows:

Delete any key value:

Del Key1

string :

Set Key1 ' python '----del key1----Get Key1

Hash :

Hmset key1 F1 v1 F2 v2----hdel key1 f1----hget Key1 F1

List :

Lpush (rpush) K1 ' python '----lpop K1

Collection :

Sadd key1 ' python '----srem key1 ' python '----smembers key1

ordered Collection (Themember values are unique and are sorted by default in order of score from small to large ):

Zadd key1 1 ' python ' 2 ' cpp '----zrem key1 ' python '----zrange Z 0 10

----Basics of 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.