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

What are the redis basic instructions and five data structures

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "what are redis basic instructions and 5 kinds of data structures". In daily operation, I believe many people have doubts about what are redis basic instructions and 5 kinds of data structures. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "what are redis basic instructions and 5 kinds of data structures". Next, please follow the editor to study!

Database instance of redis: the database instance in redis is similar to mysql. The database instance in redis can only be created and maintained by redis service, and developers cannot modify and create database instance by themselves. By default, redis automatically creates 16 database instances and numbers these database instances, starting from 0 to 15, and uses the database by number. You can specify the number of databases automatically created by redis through the configuration file; each database instance of redis takes up very little storage space, so it does not cause too much waste of storage space.

By default, the redis client connects to the database instance with the number 0; you can switch the database instance using select index.

Use the select command to switch databases (switch to library 1)

View the number of key in the current database

View all key in the current database

String type string

String type is the most basic data structure in Redis. It can store any type of data, including binary numbers.

According to the serialized data, the JSON object is even a picture. Maximum 512m

List type list

The Redis list is a simple list of strings sorted in the order in which they are inserted, and the elements can be repeated. You can add an element to the head (left) or tail (right) of the list, with a linked list structure at the bottom

Collection type set

The Set of Redis is an unordered, unrepeating collection of type string.

Hash type hash

Redis hash is a mapping table for field and value of type string, and hash is particularly suitable for storing objects.

Ordered collection type zset (sorted set)

The Redis ordered collection zset, like the collection set, is a collection of string type elements, and duplicate members are not allowed.

The difference is that each element of zset is associated with a score (the score can be repeated), and redis uses scores to sort the members of the collection from small to large.

At this point, the study of "what are the basic redis instructions and five data structures" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Development

Wechat

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

12
Report