redis Sorted Sets

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Introduction

The Sorted Set datatype in Redis is an ordered version of the Set datatype. A Redis sorted set consists of a collection of unique members. Each member in the sorted set can be thought of as a pair consisting of the member and a score. The score is used to order the members within the set in ascending order.

Syntax

  • ZADD key [NX|XX] [CH] [INCR] score member [score member ...]
  • ZCARD key
  • ZCOUNT key min max
  • ZLEXCOUNT key min max

Remarks

The official documentation for Sorted Sets can be found at the Redis.io site.

Sorted sets are sometimes referred to as zsets. If you use the TYPE command on a sorted set key, the value zset will be returned.



Got any redis Question?