sort
SORT use zset
|  Redis Developer Course |  Redis Technical Support |  Redis Enterprise Server | 
|---|
zset data를sort
Example
| 명령> | zadd myzipurl 1 Google.com 2 Facebook.com 3 Youtube.com 4 Yahoo.com 5 Baidu.com | 
| 결과> | 5 | 
| 명령> | sort myzipurl alpha member로 sort | 
| 결과> | 0) Baidu.com 1) Facebook.com 2) Google.com 3) Yahoo.com 4) Youtube.com | 
| 명령> | sort myzipurl by score alpha score로 sort | 
| 결과> | 0) Google.com 1) Facebook.com 2) Youtube.com 3) Yahoo.com 4) Baidu.com | 
zset과 by score, string key join
zset에서 by를 지정하지 않으면 member로 sort되고, by score를 지정하면 score로 sort된다.
Example
| 명령> | sort myzipurl by score get # get pv-* alpha | 
| 결과> | 0) Google.com 1) 19.60 2) Facebook.com 3) 11.62 4) Youtube.com 5) 4.58 6) Yahoo.com 7) 7.44 8) Baidu.com 9) 8.87 | 
zset과 hash key join
Example
| 명령> | sort myzipurl by score get # get url-*->pv alpha | 
| 결과> | 0) Google.com 1) 19.60 2) Facebook.com 3) 11.62 4) Youtube.com 5) 4.58 6) Yahoo.com 7) 7.44 8) Baidu.com 9) 8.87 | 
명령문
SORT key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE destination]
- 이 명령은 version 1.0.0 부터 사용할 수 있다.
- 논리적 처리 소요시간은 O(N+M*log(M))이다.
| 관련 명령 | SCAN | 
| << SORT list | SORT zset | RENAME >> | 
|---|
	Email
	
	
	답글이 올라오면 이메일로 알려드리겠습니다.
	
 


 
  
			 
			