util.memcache: Add cache:exists(key)

Sun, 01 Aug 2010 12:23:34 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 01 Aug 2010 12:23:34 +0100
changeset 16
906615e293de
parent 15
87ef478bf7fc
child 17
5bede08f2f55

util.memcache: Add cache:exists(key)

util/memcache.lua file | annotate | diff | comparison | revisions
--- a/util/memcache.lua	Sun Aug 01 12:20:27 2010 +0100
+++ b/util/memcache.lua	Sun Aug 01 12:23:34 2010 +0100
@@ -24,6 +24,10 @@
 		return true;
 	end
 	
+	function cache:exists(key)
+		return not not _data[key];
+	end
+	
 	function cache:get(key)
 		local expires = _expiry[key];
 		if expires and expires < now() then

mercurial