ZREMRANGEBYLEX

레디스 개발자 교육 신청 레디스 정기점검/기술지원
Redis Technical Support
레디스 엔터프라이즈 서버
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 답글이 올라오면 이메일로 알려드리겠습니다.