Redis字符串数据类型的实践
01:设置单个key-value对和查看单个key-value对
172.16.1.31:6379> set key1 "lili" OK 172.16.1.31:6379> get key1 "lili" ## PS:当添加key1时,若key1存在,则会修改key1之前对应的值 172.16.1.31:6379> set key1 "binbin" OK 172.16.1.31:6379> get key1 "binbin"
02:设置多个key-value对和查看多个key-value对
172.16.1.31:6379> mset key01 "chenliang" key02 "lanlan" OK 172.16.1.31:6379> mget key01 key02 1) "chenliang" 2) "lanlan" ## PS:若key01和key01存在,则会修改key01和key02之前对应的值 172.16.1.31:6379> mset key01 "chenliang666" key02 "lanlan666" OK 172.16.1.31:6379> mget key01 key02 1) "chenliang666" 2) "lanlan666"
03:向某个key中追加内容(不能同时对多个key追加内容)
172.16.1.31:6379> get key01 "chenliang666" 172.16.1.31:6379> append key01 "111111" (integer) 18 172.16.1.31:6379> get key01 "chenliang666111111"
04:判断某个key对应值的长度
172.16.1.31:6379> get key01 "chenliang666111111" 172.16.1.31:6379> strlen key01 (integer) 18
相关推荐
王道革 2020-11-25
wangdonghello 2020-11-03
Langeldep 2020-11-16
chenhualong0 2020-11-16
聚合室 2020-11-16
koushr 2020-11-12
MRFENGG 2020-11-11
guoyanga 2020-11-10
fackyou00 2020-11-10
Orangesss 2020-11-03
dongCSDN 2020-10-31
rainandtear 2020-10-30
Quietboy 2020-10-30
liuyulong 2020-10-29
fansili 2020-10-29
温攀峰 2020-10-23
jackbon 2020-10-19
kaixinfelix 2020-10-04