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"