INCRBY key increment
INCRBY 用于将 key 所存储的值加上增量 increment。127.0.0.1:6379> SET age 21 # 设置age为21 OK 127.0.0.1:6379> INCRBY age 5 # 给age加上5 (integer) 26 127.0.0.1:6379> GET age "26"
127.0.0.1:6379> EXISTS counter (integer) 0 127.0.0.1:6379> INCRBY counter 30 (integer) 30 127.0.0.1:6379> GET counter "30"
127.0.0.1:6379> SET book "how to master redis" OK 127.0.0.1:6379> INCRBY book 100 (error) ERR value is not an integer or out of range
本文链接:http://task.lmcjl.com/news/5910.html