rest-sessions icon indicating copy to clipboard operation
rest-sessions copied to clipboard

TTL doesn't seems to work?

Open sassyn opened this issue 9 years ago • 3 comments

Hi,

I have test the tool, and it is a great software! However, I not sure if the TTL effect any key under redis.

For example

curl -X PUT "http://localhost8101/mywebapp/create/username?ip=1.2.3.4&ttl=60"

provide the expected results:

{"token":"93wSlU3fsD3ndcLpBWXYBmMfN******************************************pd1"}

But when going to redis-cli I can see the key exist even after 60 sec.

Check the TTL of the key provide (integer) -1 which mean "The command returns -1 if the key exists but has no associated expire." see more here http://redis.io/commands/ttl

Is it a bug?

sassyn avatar Jul 04 '16 22:07 sassyn

Expired sessions will be cleaned periodically (by default every 10 minutes. So a session with a 60s TTL will be alive for 60s after each request. E.g. that sessions TTL timer will be reset to 60 once you use it.

If it expires it will not automatically disappear from Redis but will be cleaned via a "housekeeping" routine that runs every 10 minutes.

smrchy avatar Jul 05 '16 06:07 smrchy

@smrchy, thanks for that great software, I've found it very useful. Just curious about this issue, is the "housekeeping" routine included in this package? I couldn't find any references to it in the code.

Thanks!

wankdanker avatar Dec 08 '16 21:12 wankdanker

Yes, if you don't change anything it will run every 10 minutes.

smrchy avatar Dec 09 '16 13:12 smrchy