Redis is an open source, in-memory data structure store used as a database, cache, message broker, and streaming engine.
Redis strings store sequences of bytes, including text, serialized objects, and binary arrays. As such, strings are the simplest type of value you can associate with a Redis key.
redis以二进制保存数据
Redis lists are linked lists of string values. Redis lists are frequently used to:
(1)Implement stacks and queues.
(2)Build queue management for background worker systems.
按照列表插入顺序排序
注意:1. 允许重复出现值
A Redis set is an unordered collection of unique strings (members).
You can use Redis sets to efficiently:
(1)Track unique items (e.g., track all unique IP addresses accessing a given blog post).
(2)Represent relations (e.g., the set of all users with a given role).
(3)Perform common set operations such as intersection, unions, and differences.
Set:无序唯一的字符串或数字,操作:交、并、差
注意:1. 字符串值不能重复,不排序
Redis hashes are record types structured as collections of field-value pairs. You can use hashes to represent basic objects and to store groupings of counters, among other things.
redis-server redis.windows.conf
redis-cli -h 127.0.0.1 -p 6379
set test "test value"
如果存在不修改,如果不存在,添加
setnx key value
msetnx key value [key value...]
del key [key...]
get test
mget value [value...]
exists test
incr test
自增大于1
INCRBY key num
info [属性]
select index
dbsize
keys [键名]
type [键名]
strlen key
flushdb
flushall
clear
左插入
lpush key value [value...]
右插入
rpush key value [value...]
lrange key start stop
lrange newList 0 -1//查询全部
删除左边第一个元素
lpop key
删除右边第一个元素
rpop key
sadd key member [member……]
srem key member [member...]
smembers key
scard key
srandmember key [count]
count:随机返回的元素个数
hset hashtable:key1 key2 value
hget hashtable:key1 key2
hexists key1 key2
hdel key1 key2 [key1 key2]
bitcount key [start end]