SET
set 1 jingya
del 1
Dump, it's not going to restore.
RESTORE key TTL serialized-value
exists 1
expire 1 10 // 10s后失效
ttl 1 //只需观察1
expireat 2 1455886380 // 使用unix时间戳设置过期时间
KEYS * 匹配数据库中所有 key 。
KEYS h?llo 匹配 hello , hallo 和 hxllo 等。 // ? 匹配 1个字符
KEYS h*llo 匹配 hllo 和 heeeeello 等。 // 匹配0个或者多个
KEYS h[ae]llo 匹配 hello 和 hallo ,但不匹配 hillo // 匹配任意一个
MIGRATE host port key destination-db timeout [COPY] [REPLACE]
MIGRATE 127.0.0.1 7777 greeting 0 1000
Timeoutparameter specifies the current instance and the target instance to communicate in milliseconds .
Maximum time interval. This means that the operation does not necessarily have to beTimeoutmilliseconds to complete, just that the data transfer time cannot exceed thisTimeoutnumber.
- COPY : Does not remove the key on the source instance.
- Replace: Replaces the key that already exists on the target instance.
move key db
if the current database (source database) and the given database (the target database) have the same name as the givenKey, orKeydoes not exist in the current database, thenMOVEwithout any effect.
No
removes the givenKeyTime to Live
Pexpire
Pexpire key milliseconds
Pexpireat
PEXPIREAT key milliseconds-timestamp
Pttl
PTTL key
Randomkey
Randomly returns a key
Rename
Rename key newkey
This is a forced rename Renamenx
RENAMENX key newkey
Sort
This usage is very complicated, it takes a little time
< Span class= "PLN" >sort key [ by pattern [ limit offset Count [ get pattern [ get pattern ...] [ asc | DESC [ alpha Span class= "pun" > [ store destination
- The sort key Returns the result of the key value from small to large.
- sort key DESC Returns the result of the order of the key values from large to small.
Type
Type Key
- return to key
- none (key does not exist)
- string (String)
- list (list)
- set (collection)
- zset (ordered set)
- Hash (hash table)
Scan
SCAN cursor [MATCH pattern] [COUNT count]
From for notes (Wiz)
Redis-key operation