How to "EXPIRE" the "HSET" child key in redis?

aieven picture aieven · May 14, 2013 · Viewed 107.9k times · Source

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

Answer

Supr picture Supr · May 14, 2013

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.