willjava

导航

 

命令
SORT

说明

Sorts the input LIST, SET, or ZSET according to the options provided, and returns or stores the result

根据选项对LIST,SET,或ZSET进行排序,并返回或存储结果

语法

SORT source-key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE dest-key]

示例

1. >>> RPUSH sort-input 23 15 110 7

    >>> SORT sort-input

  ['7', '15', '23', '110']

2. >>> HSET d-7 field 5

    >>> HSET d-15 field 1

 >>> HSET d-23 field 9

 >>> HSET d-110 field 3

   >>> SORT sort-input BY d-*->field

  ['15', '110', '7', '23']

 >>> SORT sort-input BY d-*->field GET d-*->field

     ['1', '3', '5', '9']

 

 

posted on 2014-04-04 16:45  威尔爪哇  阅读(169)  评论(0)    收藏  举报