How to “EXPIRE” the “HSET” child key in redis?

前端 未结 11 2049
予麋鹿
予麋鹿 2020-11-30 21:10

I need to expire all keys in redis hash, which are older than 1 month.

11条回答
  •  再見小時候
    2020-11-30 21:25

    This is not possible, for the sake of keeping Redis simple.

    Quoth Antirez, creator of Redis:

    Hi, it is not possible, either use a different top-level key for that specific field, or store along with the filed another field with an expire time, fetch both, and let the application understand if it is still valid or not based on current time.

提交回复
热议问题