The last post is mainly about the unsorted set,in this post I will show you the sorted set playing an important
role in Redis.There are many command added after the version 2.8.9.OK,let's see the below picture firstly.There
are 24 commands to handle the sorted set,the same as the string.
playing a important role on sorting.We can use the zadd to store the sorted set.The following example demonstrates
the usage of zadd.
zrange can also make us know the @R_403_182@s of the elements,we should open seletion the with@R_403_182@s to
find out their @R_403_182@s.
There are another intresting commands to get the members.zrangeby@R_403_182@ can find out the members by
their @R_403_182@s.For an instance,I want to find out the members' @R_403_182@s between 0 and 6,so I will use 403_182@ -
zrangebylex can find out the members by the lexicographical order when some of them are in
the same @R_403_182@s.Now I want to find out the members that order by lexicography when the @R_403_182@ are the same
while in the range (a,k],so using - (a [k can easily do this job.
we use zrevrank .For example,we want to know the member d's rank.
There are also many command that we can use to remove the member from the set.Using zrem to remove one or
more members,Using zremrangebyrank to remove the members by their ranks.Using the zremrangeby@R_403_182@ to remove
the members by their @R_403_182@s.Using the zremrangebylex to remove the members by their rank and lexicography.
we use 403_182@ - e .For learning how many members in the set by the range of @R_403_182@,we can use zcount
to get the amount.To get the amount of the set by the @R_403_182@'s range [0,10],we can use - .
Can we modify the @R_403_182@s of the members?Of course we can.Not only the exists member but also the
member not in the set.If the member not exists in the set,Redis will store a new member to the set.For
example,I want to modify the @R_403_182@ of d which is not exists in the set.I will use - d to finish
this easy job.And the result is that the set will has a new member with @R_403_182@ 1.
OK,thoes commands are what I want to show you for sorted set.Let's go on to see how StackExchange.Redis
Handle the sorted set.