From 0c73d39c79f2fa0dc730901f6bcb27ca93bf5273 Mon Sep 17 00:00:00 2001 From: jomo Date: Mon, 8 Dec 2014 22:38:06 +0100 Subject: [PATCH] high scalability!!! using '.' instead of 'null' string --- modules/cache.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/cache.js b/modules/cache.js index 5fb045f..1537c71 100644 --- a/modules/cache.js +++ b/modules/cache.js @@ -67,6 +67,8 @@ exp.update_timestamp = function(uuid, hash) { exp.save_hash = function(uuid, hash) { logging.log(uuid + " cache: saving hash"); var time = new Date().getTime(); + // store shorter null byte instead of "null" + hash = hash || "."; // store uuid in lower case if not null uuid = uuid && uuid.toLowerCase(); redis.hmset(uuid, "h", hash, "t", time); @@ -80,7 +82,7 @@ exp.get_details = function(uuid, callback) { var details = null; if (data) { details = { - hash: (data.h == "null" ? null : data.h), + hash: (data.h == "." ? null : data.h), time: Number(data.t) }; }