zoukankan      html  css  js  c++  java
  • redis 分页

    redis 分页

    127.0.0.1:6379> rpush a 0
    (integer) 1
    127.0.0.1:6379> rpush a 1
    (integer) 2
    127.0.0.1:6379> rpush a 2
    (integer) 3
    127.0.0.1:6379> rpush a 3
    (integer) 4
    127.0.0.1:6379> rpush a 4
    (integer) 5
    127.0.0.1:6379> 
    -----------------------------------------
    # 把 index 存进 hset 以支持根据 index 重置 value
    127.0.0.1:6379> hset b 0 0 
    (integer) 1
    127.0.0.1:6379> hset b 1 1
    (integer) 1
    127.0.0.1:6379> hset b 2 2 
    (integer) 1
    127.0.0.1:6379> hset b 3 3
    (integer) 1
    127.0.0.1:6379> hset b 4 4
    (integer) 1
    127.0.0.1:6379> hget b 3
    "3"
    -----------------------------------------
    127.0.0.1:6379> lindex a 3
    "3"
    127.0.0.1:6379> lset a 3 33
    OK
    127.0.0.1:6379> lrange a 0 5
    1) "0"
    2) "1"
    3) "2"
    4) "33"
    5) "4"
    127.0.0.1:6379> hget b 3
    "3"
    -----------------------------------------
    # 重置
    -----------------------------------------
    127.0.0.1:6379> lset a 3 333
    OK
    127.0.0.1:6379> lrange a 0 5
    1) "0"
    2) "1"
    3) "2"
    4) "333"
    5) "4"
  • 相关阅读:
    《将博客搬至CSDN》
    2015-05-01 至 2015-07-30错误总结
    2015-01-01至2015-04-30错误积累
    2015-07-30 至 2016-03-16错误Note
    2014-11-21错误总结
    Spring 和 SpringMVC 的区别
    spring 容器加载
    Spring注解
    自定义拦截器
    Js闭包
  • 原文地址:https://www.cnblogs.com/xiluhua/p/10311811.html
Copyright © 2011-2022 走看看