# HG changeset patch # User Matthew Wild # Date 1280661627 -3600 # Node ID 87ef478bf7fcbd97b9469c74b017089cee7ab28e # Parent 578214a34ded7c2cc74f36683bdf11fc204ca593 util.memcache: Fix backwards expiry logic and nil global access diff -r 578214a34ded -r 87ef478bf7fc util/memcache.lua --- a/util/memcache.lua Sun Aug 01 12:17:31 2010 +0100 +++ b/util/memcache.lua Sun Aug 01 12:20:27 2010 +0100 @@ -26,7 +26,7 @@ function cache:get(key) local expires = _expiry[key]; - if expires and expires > now() then + if expires and expires < now() then self:delete(key); end return _flags[key], _data[key]; @@ -34,7 +34,7 @@ function cache:delete(key, time) local existed = _data[key]; - _flags[key], _data[key], _expires[key] = nil, nil, nil; + _flags[key], _data[key], _expiry[key] = nil, nil, nil; if existed and time then if time <= max_expires_seconds then time = now() + time;