- # keys [pattern], list keys
- keys *
-
- # return the number of keys in the currently-selected database
- dbsize
-
- #type [key], check the type of a key
- type key1
-
- # exists [key], if exist a key, 1, yes; otherwise, no
- exists key
- exists key1 key2
-
- # rename [key_name] [new_key_name], rename a key
- rename key1 key2
-
- # randomkey, get a random key from Redis database
- randomkey
-
- # scan [cursor] match [pattern] count [num]
- # cursor, the scan position
- # pattern, search pattern
- # num, the maxium search num, default is 10
- scan 0 count 3 # return cursor 12 and three names
- scan 12 # continue scan from cursor 12
-
- # del [key], delete a key
- del container
-
- # remove all keys
- flushall
-
- #expire [key] [seconds], setup expire time for a key
- expire key1 5
-
- # expireat [key] [timestamp]
- # timestamp is a Unix timestamp, which is seconds since Jan 01, 1970 (UTC)
- # convert time to timestamp, https://www.unixtimestamp.com/
- expireat container 1637195373
-
- # ttl [key], check expiration time
- ttl container
-
- # persist [key], remove the expiration from a key
- persist key1
-
-