Redis string related commands

1. Summary When the
value in Redis is a string, you can append, modify the range, get the range, add and subtract as an array, etc.
Two, use example


127.0.0.1:6379> SET test 1
OK
127.0.0.1:6379> INCR test
(integer) 2
127.0.0.1:6379> INCRBY test 10
(integer) 12
127.0.0.1:6379> DECR test
(integer) 11
127.0.0.1:6379> DECRBY test 5
(integer) 6
127.0.0.1:6379> APPEND test ffffff
(integer) 7
127.0.0.1:6379> GET test
"6ffffff"
127.0.0.1:6379> STRLEN test
(integer) 7
127.0.0.1:6379> SETRANGE test 2 bbbb
(integer) 7
127.0.0.1:6379> GET test
"6fbbbbf"
127.0.0.1:6379> GETRANGE test 3 5
"bbb"
127.0.0.1:6379> APPEND test "ffffff"
(integer) 13
127.0.0.1:6379> GET test
"6fbbbbfffffff"

Guess you like

Origin blog.csdn.net/gamekit/article/details/107588012