Memcache is dead simple to use, but does have one non-obvious “gotcha” that according to some discussions on Stackoverflow/etc have caught a lot of developers off guard…

“expires_in” has a maximum of 30 days; if set to more than that it will treat the integer seconds as an actual date. So “90.days” actually is equivalent to a date in the 1970s.

That has important implications if, for example, you are using the excellent rack_attack gem to try to ban certain evil-doers for, say, 90.days using code like this:

Rack::Attack::Fail2Ban.filter("pentesters-#{req.ip}", 
  :maxretry => 1, 
  :findtime => 240.minutes, 
  :bantime => 90.days) do 
...

In that example the memcache entry for the ban will be set to have an expiry in 1970.