How Long Are Keys Stored? How Do I Set Key Expiration?
- Key storage duration
- Keys that do not have an expiration are stored permanently.
- Keys that have an expiration are deleted after they expire. For details, see Scanning Expired Keys.
- To remove the expiration set for a key, run the PERSIST command.
- Setting key expiration
You can run the EXPIRE or PEXPIRE command to set the key expiration time. For example, if you run expire key1 100, key1 will expire in 100 seconds. If you run pexpire key2 1800, key2 will expire in 1800 milliseconds.
EXPIRE sets key expiration in seconds, and PEXPIRE sets key expiration in milliseconds.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot