ZREMRANGEBYLEX

Redis 開発者教育の申込 Redis 定期点検/技術サポート
Redis Technical Support
Redis エンタープライズサーバー
Redis Enterprise Server

member で範囲を指定して削除

使い方は zremrangebylex key min max です。
min、max は member の範囲です。すべて削除するには -, + を使います。
min、max に値を付ける場合は必ず前に [ または ( を使う必要があります。
[ は値を含むときに使い、( は除外するときに使います。
このコマンドは score がすべて同じでなければ望む結果を得られません。

Example

コマンド>zadd city 0 "New Delhi" 0 "Seoul" 0 "Beijing" 0 "New York"
結果>4
コマンド>zrangebylex city - +
結果> 0) Beijing
1) New Delhi
2) New York
3) Seoul
コマンド>zremrangebylex city "(New Delhi" "(Seoul"
結果>1
コマンド>zrangebylex city - +
結果> 0) Beijing
1) New Delhi
2) Seoul
コマンド>zremrangebylex city "[New Delhi" "(Seoul"
結果>1
コマンド>zrangebylex city - +
結果> 0) Beijing
1) Seoul
コマンド>zremrangebylex city "[New Delhi" "[Seoul"
結果>1
コマンド>zrangebylex city - +
結果> 0) Beijing

アニメーションを見る



構文

ZREMRANGEBYLEX key min max

  • このコマンドは version 2.8.9 から使用できます。
  • 時間計算量は O(log(N)+M) です。 N は集合に属する member 個数で、 M は削除される member 個数です。
関連コマンド ZRANGE, ZREVRANGE, ZREVRANGEBYSCORE, LRANGE
Clients for Java Jedis, Lettuce, Redisson
Clients for C Hiredis

<< ZREMRANGEBYSCORE ZREMRANGEBYLEX ZUNION >>

Email 返事がかかってなれば、メールでお知らせします。