exptime unclear

Brad Fitzpatrick brad at danga.com
Sun Dec 24 19:20:54 UTC 2006


Fixed:

2006-12-23
        * fix expirations of items set with absolute expiration times in
          the past, before the server's start time.  bug was introduced in
          1.2.0 with rel_time_t.  Thanks to Adam Dixon
          <adamtdixon at gmail.com> for the bug report and test case!

Sending        server/ChangeLog
Sending        server/memcached.c
Sending        server/t/expirations.t
Transmitting file data ...
Committed revision 456.


Thanks!



On Wed, 20 Dec 2006, Adam Dixon wrote:

> Hello all,
> I have memcached running for our authentication systems, which hinges
> on the UNIX_TIMESTAMP(ExpireDate) which I use to also expire the
> memcached record.
>
> What I have found is that, if a record is set, and the timestamp is
> already passed the current time, it caches it - and sometimes keeps
> it, whereas I would have thought it to dump it straight away as
> expired.
>
> I would of thought that this was how it would work? Instead it appears
> to have something to do with how long the server has been up.
>
> # perl y.pl 5700
> Setting key with exp of 1166588860
> The time is now 1166594560 which is -5700 seconds diff.
> memcached up for 5662, started at 1166588898 and exptime of -38
> Get key ... Gotit.
> memcached up 5662sec.
> Get key ... Gotit.
> .....
> memcached up 5667sec.
> Get key ... Gotit.
> memcached up 5668sec.
> Get key ... Gotit.
> memcached up 5669sec.
> ....
>
> Ok so a object that's 5600 seconds old stays in the cache? for how
> long I don't know.
>
> # perl y.pl 5600
> Setting key with exp of 1166588972
> The time is now 1166594572 which is -5600 seconds diff.
> memcached up for 5673, started at 1166588898 and exptime of 74
> Get key ...DontGotit.
> memcached up 5673sec.
> Get key ...DontGotit.
> .....
> memcached up 5676sec.
> Get key ...DontGotit.
> memcached up 5677sec.
> ....
>
> This one however is not in the cache, which is to be expected.
>
> Is there pseudo code for this process?
> Is this a bug or do I have to change all my application code to
> somehow handle this? OR I have it completely wrong.
>
> Kind regards,
> Adam
>
>


More information about the memcached mailing list