In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you the "Redis data structure and commonly used commands are", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what are the Redis data structures and common commands" this article.
1. Redis introduction
Redis is an open source API that is written in C language, supports the network, can be memory-based and persistent, Key-Value database, and provides multiple languages.
It is essentially a client-server application software program.
It is characterized by simple use, strong performance and rich functional application scenarios.
two。 The general command command describes the DEL key. This command is used to delete the key when the key exists. DUMP key serializes the given key and returns the serialized value. EXISTS key checks whether a given key exists. EXPIRE key seconds sets the expiration time for a given key in seconds. TTL key returns the remaining time to live (TTL, time to live) for a given key in seconds. TYPE key returns the value type stored by key. 3. Data structure 1. String
The String data structure is a simple key-value type, and value is not only a String, but also a number.
Usage scenarios: number of Weibo, number of fans (regular calculation)
Common command
Command description Get gets the value of the specified key Set sets the value of the specified key Incr increases the numeric value stored in key by one Decr subtracts the numeric value stored in key by one Mget gets the value of all (one or more) given key 2. List
List is a linked list.
Usage scenarios: Weibo follow list, fan list
Common command
The command describes that Lpush inserts one or more values into the list header Rpush adds one or more values to the list Lpop remove and gets the first element of the list, the return value is the removed element Rpop removes the last element of the list, and the return value is the removed element Lrange to get the value of all (or more) of the given key 3. Set
Set is a collection, and the concept of a set is a combination of unrepeated values. Using the Set data structure provided by Redis, some collective data can be stored.
Usage scenarios: realization such as common concern, common preferences, second-degree friends.
Common command
The command describes Sadd to add one or more members to the collection Spop remove and return a random element in the collection Smembers returns all members of the collection Sunion returns the union of all given collections 4. Sorted set
The usage scenario of Sorted set is similar to that of set, except that set is not automatically ordered, while sorted set can sort members by providing an additional parameter of score, and it is inserted in order, that is, automatic sorting.
Usage scenarios: ranking, sorting by user vote and time
Common command
The command describes Zadd to add one or more members to the ordered set, or to update the score of existing members Zrange. Hash removes one or more members from the ordered set by returning the member Zcard in the specified interval of the ordered set through the index interval. Hash
Hash is a mapping table for field and value of type String.
Usage scenarios: store some change data, such as user information.
Common command
Version 3.2 begins to support GEO (geolocation).
Usage scenario: LBS application development.
Common command
The command describes GEOADD to increase the coordinates of geographic locations. You can add geographic locations in batches, GEODIST to get the distance between two geographic locations, GEOHASH to get the geohash value of a geographic location, GEOPOS to get the coordinates of a specified location. You can obtain the coordinates of multiple geographic locations in batches GEORADIUS acquires a set of geographic locations within a specified range based on given geographic location coordinates (note: the center point of the command is determined by the longitude and latitude entered) GEORADIUSBYMEMBER gets the set of location information within the specified range according to the position of a given member (note: the center point of the command is determined by a given location element) 7. Stream
New structure "stream" starting with version 5.0
Usage scenario: consumer producer scenario (similar to MQ)
Common command
The command describes XADD to add messages to the specified flow the number of messages in the XLENstream flow XDEL deletes messages in the stream XRANGE return stream messages that meet the given ID range XREAD reads messages from one or more streams XINFO retrieves different information about the stream and associated consumer groups all the contents of the article "what are the Redis data structures and common commands?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.