1. 程式人生 > >redis基礎數據類型

redis基礎數據類型

Redis

set name linux
get name
keys *
exists name
del name
type name

String(字符串)
set page_view 20
get page_view
INCR page_view
INCR page_view 2
DECR page_view
DECR page_view 2
STRLEN page_view

Hash(哈希表)
HSET car price 200000
HSET car name BMW
type car
HGETALL car
HGET car price
HGET car name
HDEL car name
HKEYS car
HLEN car
del car

List(列表)

LPUSH numbers 1
LPUSH numbers a
RPUSH numbers 1
RPUSH numbers a
LLEN numbers
LRANGE numbers 0 -1
LPOP numbers
LRANGE numbers 0 -1

Set(集合)
SADD a 1
SADD a 2
SADD a 3
SADD b 2
SADD b 3

type a
SMENBERS a
SISMENBER a 1
SDIFF a b
SINTER a b
SUNION a b

redis基礎數據類型