本文共 474 字,大约阅读时间需要 1 分钟。
Redis中的所有键(Key)都以字符串形式存在。
Redis中的最基础数据类型,一个键对应一个值。String类型具有二进制安全性,能够存储任何类型的数据,包括数字、字符串、图片或序列化的对象等。
常用命令包括:get、set、del、incr、decr等。通过这些命令可以对String值进行读写操作。
例如:
127.0.0.1:6379> set hello world OK 127.0.0.1:6379> get hello "world" 127.0.0.1:6379> del hello (integer) 1127.0.0.1:6379> get hello (nil) 127.0.0.1:6379> get counter "2" 127.0.0.1:6379> incr counter (integer) 3127.0.0.1:6379> get counter "3" 127.0.0.1:6379> incrby counter 100
转载地址:http://cftfk.baihongyu.com/