Hacker News new | past | comments | ask | show | jobs | submit login

You can do something similar using the Expire TTL by setting a date way in the future.

  redis-cli SETEX mykey 310536000000 "helllooo"
   myttl = $(redis-cli TTL mykey)
   mdate = 310536000000 - $myttl



Only if you have distinct keys. Most Redis use I’ve seen “at scale” has involved putting things in hashes/sets/lists.

(I’ve wondered for a while now whether it’d be possible to implement expiry in Redis for sub-key data, without introducing too much overhead to data structures that don’t need expiry. I’d think it’d be “just” a matter of having an alternative data representation that holds expiries for each element in the data structure, and then re-encoding the data structure over to that data representation when at least one element has an expiry — because if one does, then it’s likely that many will.)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: