SORT use list

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

list data を sort

Example

コマンド>lpush mylisturl Google.com Facebook.com Youtube.com Yahoo.com Baidu.com
結果>5
コマンド>sort mylisturl alpha
結果> 0) Baidu.com
1) Facebook.com
2) Google.com
3) Yahoo.com
4) Youtube.com
コマンド>sort mylisturl alpha desc
結果> 0) Youtube.com
1) Yahoo.com
2) Google.com
3) Facebook.com
4) Baidu.com


list と string key の join get

Example

コマンド>sort mylisturl get # get pv-* alpha
結果> 0) Baidu.com
1) 8.87
2) Facebook.com
3) 11.62
4) Google.com
5) 19.60
6) Yahoo.com
7) 7.44
8) Youtube.com
9) 4.58


list と string key の join order

Example

コマンド>sort mylisturl by pv-* get # get pv-* desc get pv-* desc
結果> 0) Google.com
1) 19.60
2) Facebook.com
3) 11.62
4) Baidu.com
5) 8.87
6) Yahoo.com
7) 7.44
8) Youtube.com
9) 4.58


list と hash, string key の join order

Example

コマンド>sort mylisturl by url-*->pv desc get # get pv-* get url-*->rank
結果> 0) Google.com
1) 19.60
2) 1
3) Facebook.com
4) 11.62
5) 2
6) Baidu.com
7) 8.87
8) 5
9) Yahoo.com
10) 7.44
11) 4
12) Youtube.com
13) 4.58
14) 3

アニメーションを見る



構文

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 hash SORT list SORT zset >>

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