zoukankan      html  css  js  c++  java
  • Redis 排序

    命令 : SORT

    用例和描述 : SORT source-key [BY pattern] [LIMIT offset count] [GET pattern [GET pattern ...]] [ASC|DESC] [ALPHA] [STORE dest-key] —— 根据给定的选项,对输入的列表集合或者有序集合进行排序,然后返回或者存储排序的结果

    例子 :

    127.0.0.1:6379> rpush sort-input 23 15 110 7
    (integer) 4
    127.0.0.1:6379> sort sort-input
    1) "7"
    2) "15"
    3) "23"
    4) "110"
    # 根据字母表顺序排序
    127.0.0.1:6379> sort sort-input alpha
    1) "110"
    2) "15"
    3) "23"
    4) "7"
    127.0.0.1:6379> hset d-7 field 5
    (integer) 1
    127.0.0.1:6379> hset d-15 field 1
    (integer) 1
    127.0.0.1:6379> hset d-23 field 9
    (integer) 1
    127.0.0.1:6379> hset d-110 field 3
    (integer) 1
    127.0.0.1:6379> sort sort-input by "d-*->field"
    1) "15"
    2) "110"
    3) "7"
    4) "23"
    127.0.0.1:6379> sort sort-input by "d-*->field" get "d-*->field"
    1) "1"
    2) "3"
    3) "5"
    4) "9"
     
  • 相关阅读:
    c++ 的几种强制转换的讨论
    观察者模式
    epoll实现linux进程通信
    vim 实现 go to definition的功能
    svn 的使用
    makefile文件的技术
    [转]epoll技术
    [转]poll技术
    Linux重定向的理解
    避免僵死进程的方法
  • 原文地址:https://www.cnblogs.com/zawier/p/8530375.html
Copyright © 2011-2022 走看看