#### 1. set,get,mset,mget 賦值取值 --- **set,get 單個賦值和單個取值** ``` 127.0.0.1:6379> set liang 123456 OK 127.0.0.1:6379> get liang "123456" 127.0.0.1:6379> ``` **mset,mget 批量賦值和批量取值** ``` 127.0.0.1:6379> mset one 123 two 456 OK 127.0.0.1:6379> mget one two 1) "123" 2) "456" 127.0.0.1:6379> ``` #### 2. incr,decr,incrby,decrby 用于遞減和遞減 --- **當(dāng)存儲的字符串為數(shù)字時,可使用 incr,decr,incrby,decrby 遞增遞減** **incr,decr 遞增遞減 1** ``` 127.0.0.1:6379> set age 20 OK 127.0.0.1:6379> incr age (integer) 21 127.0.0.1:6379> get age "21" 127.0.0.1:6379> decr age (integer) 20 127.0.0.1:6379> get age "20" 127.0.0.1:6379> ``` **incrby,decrby 遞增遞減指定的步長** ``` 127.0.0.1:6379> set age 20 OK 127.0.0.1:6379> incrby age 5 (integer) 25 127.0.0.1:6379> get age "25" 127.0.0.1:6379> decrby age 5 (integer) 20 127.0.0.1:6379> get age "20" 127.0.0.1:6379> ```