redis
redis 127.0.0.1:6379> COMMAND KEY_NAME
127.0.0.1:6379> set jack redis
OK
127.0.0.1:6379> DEL jack
(integer) 1
127.0.0.1:6379>
DEL , jack 。 (integer) 1, (integer) 0
Redis :http://doc.redisfans.com/index.html
DEL key
,
DUMP key
。
redis> SET greeting "hello, dumping world!"
OK
redis> DUMP greeting
"\x00\x15hello, dumping world!\x06\x00E\xa0Z\x82\xd8r\xc1\xde"
redis> DUMP not-exists-key
(nil)
EXISTS key
key , 1 , 0 。
redis> SET db "redis"
OK
redis> EXISTS db
(integer) 1
redis> DEL db
(integer) 1
redis> EXISTS db
(integer) 0
EXPIRE key seconds
127.0.0.1:6379> EXPIRE jack 30
(integer) 1
127.0.0.1:6379> TTL jack
(integer) 21
127.0.0.1:6379> TTL jack
(integer) 19
127.0.0.1:6379> TTL jack
(integer) 18
127.0.0.1:6379> TTL jack
(integer) 17
EXPIREAT key timestamp
。 , Unix
PEXPIRE key milliseconds
PEXPIREAT key milliseconds-timestamp
Unix
KEYS pattern
MOVE key db
PERSIST key
127.0.0.1:6379> set jack 20
OK
127.0.0.1:6379> EXPIRE jack 10
(integer) 1
127.0.0.1:6379> TTL jack
(integer) 5
127.0.0.1:6379> TTL jack
(integer) 3
127.0.0.1:6379> PERSIST jack
(integer) 0
127.0.0.1:6379> TTL jack
(integer) -2
PTTL key
TTL key
。
RANDOMKEY
Redis
RENAME key newkey
127.0.0.1:6379> set jack 20
OK
127.0.0.1:6379> KEYS jack
1) "jack"
127.0.0.1:6379> RENAME jack lucy
OK
127.0.0.1:6379> KEYS jack
(empty list or set)
127.0.0.1:6379> KEYS lucy
1) "lucy"
RENAMENX key newkey
,
TYPE key
。
127.0.0.1:6379> KEYS *
1) "bbs"
2) "user:1"
3) "user:2"
4) "page_rank"
5) "greeting"
6) "languages"
7) "lucy"
127.0.0.1:6379> TYPE bbs
set
127.0.0.1:6379> TYPE user:1
hash
127.0.0.1:6379> TYPE range_rank
none
127.0.0.1:6379> TYPE lucy
string
127.0.0.1:6379> TYPE greeting
string
127.0.0.1:6379>