util/memcache.lua

changeset 16
906615e293de
parent 15
87ef478bf7fc
child 17
5bede08f2f55
equal deleted inserted replaced
15:87ef478bf7fc 16:906615e293de
22 end 22 end
23 _data[key] = data; 23 _data[key] = data;
24 return true; 24 return true;
25 end 25 end
26 26
27 function cache:exists(key)
28 return not not _data[key];
29 end
30
27 function cache:get(key) 31 function cache:get(key)
28 local expires = _expiry[key]; 32 local expires = _expiry[key];
29 if expires and expires < now() then 33 if expires and expires < now() then
30 self:delete(key); 34 self:delete(key);
31 end 35 end

mercurial