标签:add 序列 系统 字符串 二进制安全 mem sqli rem zadd
REmote DIctionary Server(Redis),一个 key-value 存储系统。
Redis 支持五种数据类型:string(字符串),hash(哈希),list(列表),set(集合)及zset(sorted set:有序集合)。
相关命令:set
, get
127.0.0.1:6379> set str1 hello
OK
127.0.0.1:6379> get str1
"hello"
相关命令:hmset
, hmget
, hgetall
127.0.0.1:6379> hmset hashmap1 name hiwangzi blog hiwangzi.com
OK
127.0.0.1:6379> hmget hashmap1 name
1) "hiwangzi"
127.0.0.1:6379> hgetall hashmap1
1) "name"
2) "hiwangzi"
3) "blog"
4) "hiwangzi.com"
相关命令:lpush
, lrange
127.0.0.1:6379> lpush list1 a b
(integer) 2
127.0.0.1:6379> lrange list1 0 100
1) "b"
2) "a"
127.0.0.1:6379> lpush list1 c
(integer) 3
127.0.0.1:6379> lrange list1 0 2
1) "c"
2) "b"
3) "a"
相关命令:sadd
, smembers
127.0.0.1:6379> sadd set1 a b
(integer) 2
127.0.0.1:6379> smembers set1
1) "b"
2) "a"
127.0.0.1:6379> sadd set1 c
(integer) 1
127.0.0.1:6379> smembers set1
1) "b"
2) "c"
3) "a"
127.0.0.1:6379> sadd set1 a
(integer) 0
127.0.0.1:6379> smembers set1
1) "b"
2) "c"
3) "a"
# a 被添加了两次,但集合有唯一属性,所以只会存储一个。
相关命令:zadd
, zrangebyscore
redis 127.0.0.1:6379> zadd yiibaiset 0 redis
(integer) 1
redis 127.0.0.1:6379> zadd yiibaiset 0 mongodb
(integer) 1
redis 127.0.0.1:6379> zadd yiibaiset 1 sqlite
(integer) 1
redis 127.0.0.1:6379> zadd yiibaiset 1 sqlite
(integer) 0
redis 127.0.0.1:6379> ZRANGEBYSCORE yiibaiset 0 1000
1) "mongodb"
2) "redis"
3) "sqlite"
标签:add 序列 系统 字符串 二进制安全 mem sqli rem zadd
原文地址:http://www.cnblogs.com/hiwangzi/p/7872019.html