Closed imikod closed 8 years ago
Yes, this is by design. It's not ideal and I've debated using a timestamp rather than a TTL duration, but ran into other issues with the timestamp. So I ended up settling on using a duration, which mimics the functionality of Redis's TTLs. And Redis also suffers from the same issue.
I have an idea though. I think I'll explore it and get back to you shortly.
I just added a feature that will compare the ttl against the database mod time at load.
if noKeyTTL || (keyTTL-time.Now().Sub(dbLastModTime) > 0) {
... load the key into the database ...
}
I think that this will suffice for the majority of cases.
Let me know if this works for you.
Yes thank you that works for me! For redis or redcon it isn't a big deal but for embedded use it's somewhat different.
Great to hear. Thanks a ton for your help.
It seems like the expiration only works as long as the program does not exit before the expiration.
If I set a key to expire in 10 seconds and the program finishes in 5 I can run it as many times as I want without the expiration ever happening. Is this intentional?