Redis Learning-3.6: Detailed Explanation of Keys Common Commands

get all keys

keys *

blob.png

Keys starting with my query keys my?

blob.png

delete key del my1

blob.png

Batch deletion is del key1 key2 key3

Check whether a certain key exists, 1 exists, 0 does not exist

exists my1

blob.png

Rename the key: rename num1 mynum

rename num1 to mynum

blob.png

expire mynum 1000 (expired and deleted after 1000 seconds)

blob.png

ttl mynum View the remaining time of mynum

blob.png

Returns -1 if not set




Get the type of the specified key

type xxx

blob.png

(yuwen was emptied by me, so he was also deleted and returned to None)

Guess you like

Origin blog.csdn.net/qq_22570497/article/details/78474928