zremrangebyscore
ZREMRANGEBYSCORE
Redis 開発者教育の申込
|
Redis 定期点検/技術サポートRedis Technical Support |
Redis エンタープライズサーバーRedis Enterprise Server |
|---|
score で範囲を指定して member を削除
使い方は zremrangebyscore key min max です。
min、max は score の範囲です。すべて削除するには -inf, +inf を使います。+inf の + は省略できます。
min、max をそのまま使うと指定した値を含めて削除します。
min、max の値を除外するには前に '(' を使います。
Example
| コマンド> | zadd city 50 "New Delhi" 60 "Seoul" 70 "Beijing" 80 "New York" |
| 結果> | 4 |
| コマンド> | zrangebyscore city -inf inf withscores |
| 結果> |
0) 50 -> New Delhi 1) 60 -> Seoul 2) 70 -> Beijing 3) 80 -> New York |
| コマンド> | zremrangebyscore city -inf (70 |
| 結果> | 2 |
| コマンド> | zrangebyscore city -inf inf withscores |
| 結果> |
0) 70 -> Beijing 1) 80 -> New York |
| コマンド> | zremrangebyscore city -inf 70 |
| 結果> | 1 |
| コマンド> | zrangebyscore city -inf inf withscores |
| 結果> |
0) 80 -> New York |
構文
ZREMRANGEBYSCORE key min max
- このコマンドは version 1.2.0 から使用できます。
- 時間計算量は O(log(N)+M) です。 N は集合に属する member 個数で、 M は削除される member 個数です。
| 関連コマンド | ZREMRANGEBYSCORE, ZREMRANGEBYLEX, ZREMRANGEBYRANK, SREM, HDEL |
| Clients for Java | Jedis, Lettuce, Redisson | Clients for C | Hiredis |
| << ZREMRANGEBYRANK | ZREMRANGEBYSCORE | ZREMRANGEBYLEX >> |
|---|
Email
返事がかかってなれば、メールでお知らせします。
