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 of NoSQL (under data type)

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1.set Typ

(1) order

① adds elements

Syntax: SADD key member [member...]

② delete element

Syntax: SREM key member [member...]

③ gets all the elements in the collection

Syntax: SMEMBERS key

④ determines whether the element is in the collection

Syntax: SISMEMBER key member

(2) Operation commands of sets

① difference set

Syntax: SDIFF key [key...]

② intersection

Syntax: SINTER key [key...]

③ union

Syntax: SUNION key [key...]

(3) Enhancement order

① gets the number of elements in the collection

Syntax: SCARD key

② randomly pops an element from the collection

Syntax: SPOP key

2. Sortedset

(1) introduction: sortedset is an ordered set, which can be sorted, but the only difference between sortedset and set is that sortedset adds a score to the element, and then sorts it by score.

(2) order

① adds elements

Syntax: ZADD key score member [score member...]

② gets the score of the element

Syntax: ZSCORE key member

③ delete element

Syntax: ZREM key member [member...]

④ gets a list of elements ranked in a certain range

Note: all elements indexed from start to stop are returned in the order of element scores.

Syntax: ZRANGE key start stop [WITHSCORES]

Returns all elements indexed from start to stop in the order of element scores from high to low

Syntax: ZREVRANGE key start stop [WITHSCORES]

Rank elements and get scores

⑤ gets the ranking of elements:

From small to big:

Syntax: ZRANK key member

From big to small

Syntax: ZREVRANK key member

(2) Enhancement order

① gets the elements between the specified scores

Syntax: ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]

② increases the score of an element

Syntax: ZINCRBY key increment member

③ gets the number of elements in the collection

Syntax: ZCARD key

④ deletes elements according to the range of rankings

Syntax: ZREMRANGEBYRANK key start stop

⑤ deletes elements by score range

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

Database

Wechat

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

12
Report