ZREM

AttentionThis page documents an earlier version. Go to the latest (v2.1)version.

Synopsis

ZREM key member [member…]This command removes the members specified in the sorted set at key and returns the number of members removed.Members specified that do not exist in key are ignored. If key does not exist, 0 is returned.If key is associated with non sorted-set data, an error is returned.

Return Value

The number of members removed from the sorted set.

Examples

You can do this as shown below.

  1. $ ZADD z_key 1.0 v1 2.0 v2
  1. (integer) 2
  1. $ ZREM z_key v2 v3
  1. (integer) 1
  1. $ ZREM z_key v1 v2 v3
  1. (integer) 1
  1. $ ZCARD z_key
  1. (integer) 0

See Also

zadd, zcard, zrange, zrangebyscore, zrevrange