redis-----key-value

4556 ワード

redisのkey-valueタイプで、キー値ペアを格納します.
# set     
127.0.0.1:6379> set name wk
OK
# get     
127.0.0.1:6379> get name
"wk"
# del     
127.0.0.1:6379> del name
(integer) 1
127.0.0.1:6379> get name
(nil)

# exists       key      10
127.0.0.1:6379> exists user
(integer) 0
127.0.0.1:6379> exists name
(integer) 1

# expire           
127.0.0.1:6379> set name name
OK
127.0.0.1:6379> get name
"name"
127.0.0.1:6379> expire name 10
(integer) 1
127.0.0.1:6379> get name
"name"
127.0.0.1:6379> get name
"name"
127.0.0.1:6379> get name
(nil)

# EXPIREAT key timestamp           ,  Unix   --   
# PEXPIRE key milliseconds       ,    
# PEXPIREAT key milliseconds-timestamp          ,js    --  
# KEYS pattern     pattern  key
# MOVE key db         key           db   
# PERSIST key    keykey      
# PTTL key          key         
# TTL keykey        (TTL, time to live)
# RANDOMKEY               key
# RENAME key newkey    key    
# RENAMENX key newkey    newkey     ,  key     newkey
# TYPE key    key