In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Detailed explanation of the inner type of redis string
String
A string in Redis is a sequence of bytes. Strings in Redis are binary safe, which means that their length is not determined by any special termination character. Therefore, anything up to 512 megabytes can be stored in a string.
Example
Redis 172.16.10.1 OK redis 6379 > set name "baidu.com" OK redis 172.16.10.1 OK redis 6379 > get name "baidu.com" Shell
In the above example, set and get are the Redis commands, name is the key used in Redis, and baidu.com is the value of the string stored in Redis.
Note-the Redis command is not case sensitive, for example, SET,Set and set are the same command. The maximum length of a string value is 512MB.
Hash / hash
The Redis hash / Hashes is a collection of key-value pairs. A Redis hash / hash is a mapping between string fields and string values. Therefore, they are used to represent objects.
Example
Redis 172.16.10.1 baidu 6379 > HMSET ukey username "password" passswd123 "points 200Shell
In the above example, the hash / hash data type is used to store user objects that contain basic information about the user. Here HMSET,HGETALL is the command of Redis, and ukey is the name of the key.
Each hash / hash can store up to 2 ^ 32-1 key-value pairs (more than 4 billion).
List
The Redis list is just a list of strings sorted in the order in which they are inserted. You can add elements to the head or tail of the Redis list.
Example
Redis 172.16.10.1 redis 6379 > lpush alist redis (integer) 1 redis 172.16.10.1 sqlite 6379 > lpush alist mongodb (integer) 2 redis 172.16.10.1 sqlite 6379 > lpush alist sqlite (integer) 3 redis 172.16.10.1 lrange alist 0101) "sqlite" 2) "mongodb" 3) "redis" Shell
The maximum length of a list is 2 ^ 32-1 elements (4294967295, each list can hold more than 4 billion elements).
Set
The Redis collection is an unordered collection of strings. In Redis, you can add, remove, and test the time O (1) complexity of a member's existence.
Example
Redis 172.16.10.1 redis 6379 > sadd baidulist redis (integer) 1 redis 172.16.10.1 redis 6379 > sadd baidulist mongodb (integer) 1 redis 172.16.10.1 redis 6379 > sadd baidulist sqlite (integer) 1 redis 172.16.10.1 sadd baidulist sqlite (integer) 0 redis 172.16.10.16379 > smembers baidulist 1) "sqlite" 2) "mongodb" 3) "redis" Shell
Note-in the above example, sqlite is added twice, but because of the unique properties of the collection, it is only added once.
The maximum number of members in a collection is 2 ^ 32-1 (that is, 4294967295, the number of elements in each collection can be up to 4 billion).
Sortable set
Redis sortable sets are similar to Redis collections in that they are non-repeating character sets. The difference is that each member of the sorted set is associated with a score, which is used for sorted collections sorted by minimum to maximum scores. Although members are unique, score values can be repeated.
Example
Redis 172.16.10.1 redis (integer) 1 redis 172.16.10.1 redis 172.16.10.1 integer 6379 > zadd baiduset 0 mongodb (integer) 1 redis 172.16.10.1 sqlite (integer) 1 redis 172.16.10.16379 > zadd baiduset 1 sqlite (integer) 0 redis 172.16.10.1) ZRANGEBYSCORE baiduset 0 1000 1) "mongodb" 2) "redis" 3) "sqlite Shell"
Because the sort value of 'sqlite' is 1, and the sort value of the other two elements is 0,' sqlite' comes last.
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.