diff --git a/lib/cache.js b/lib/cache.js index 2bb3362..4b2eb96 100644 --- a/lib/cache.js +++ b/lib/cache.js @@ -99,7 +99,7 @@ exp.info = function(callback) { exp.update_timestamp = function(rid, userId, hash, temp, callback) { logging.log(rid, "cache: updating timestamp"); var sub = temp ? (config.local_cache_time - 60) : 0; - var time = new Date().getTime() - sub; + var time = Date.now() - sub; // store userId in lower case if not null userId = userId && userId.toLowerCase(); redis.hmset(userId, "t", time, function(err) { @@ -114,7 +114,7 @@ exp.update_timestamp = function(rid, userId, hash, temp, callback) { // +callback+ contans error exp.save_hash = function(rid, userId, skin_hash, cape_hash, callback) { logging.log(rid, "cache: saving skin:" + skin_hash + " cape:" + cape_hash); - var time = new Date().getTime(); + var time = Date.now(); // store shorter null byte instead of "null" skin_hash = (skin_hash === null ? "" : skin_hash); cape_hash = (cape_hash === null ? "" : cape_hash); diff --git a/lib/helpers.js b/lib/helpers.js index cea983b..de65da9 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -225,7 +225,7 @@ exp.get_image_hash = function(rid, userId, type, callback) { if (err) { callback(err, -1, null); } else { - if (cache_details && cache_details[type] !== undefined && cache_details.time + config.local_cache_time * 1000 >= new Date().getTime()) { + if (cache_details && cache_details[type] !== undefined && cache_details.time + config.local_cache_time * 1000 >= Date.now()) { // use cached image logging.log(rid, "userId cached & recently updated"); callback(null, (cached_hash ? 1 : 0), cached_hash);