mumoshu / play2-memcached

A memcached plugin for Play 2.x
Other
161 stars 66 forks source link

Expiration is buggy for periods over 30 days #36

Open luksow opened 9 years ago

luksow commented 9 years ago

Memcached interprets expirations over 30 days (so over 2592000 seconds) as UNIX timestamps (see https://code.google.com/p/memcached/wiki/NewProgramming#Expiration). That case is not handled in code, so when passing the 30 days threshold keys are immediately expired as the resulting "timestamp" is in the past.

I wanted to handle that by setting https://github.com/mumoshu/play2-memcached/blob/master/plugin/src/main/scala/com/github/mumoshu/play2/memcached/MemcachedPlugin.scala#L136 to System.currentTimeMillis() + expiration but it looks like memcached client is only handling ints so that would be extremely risky. Ideas?