user2219372
user2219372

Reputation: 2455

how to expire a key of a map in REDIS?

I use redis to store the users information.

i set many use's info under the key "user",like this:

"hset user userid1234 {...}".

how to make the key "userid1234" in the user expires in some seconds later?

there is some commands like "expire" which can only set the timeout of user but i dont want all in it expires.

is there some solutions?

Upvotes: 4

Views: 5771

Answers (1)

Tw Bert
Tw Bert

Reputation: 3809

No, this is not possible. TTL lives on the key, not on the member. And this won't change.

On how to deal with this, read Josiah Carlson's suggestions here. I can also recommend reading his book.

Cheers, TW

Upvotes: 5

Related Questions