Redis_Keys common operations

1. View all keys

  • keys *

2. View the keys at the beginning of a field

  • keys field? For example: keys class? View, the keys at the beginning of the class field

3. Delete a key

  • del key1 、 key2 、 key3 ...

4. Determine whether a key exists

  • The exists key name returns (int) 1, if it does not exist, returns (int) 0

5. Rename a key

  • rename key name new key name

6. Add expiration time to the key

  • expire key name time (seconds)

7. Check the expiration time of a key

  • ttl key name

8. View the type of a key

  • type key名

Guess you like

Origin blog.csdn.net/weixin_43272542/article/details/112130563