Permalink
Browse files

cleanup coding style after merge

  • Loading branch information...
1 parent e479c1a commit f7fa5733e7fce723abccecdec111a145b93ce480 @ptarjan committed Aug 7, 2012
Showing with 3 additions and 15 deletions.
  1. +2 −5 index.js
  2. +1 −10 test.js
View
@@ -7,20 +7,17 @@ var missCount = 0;
exports.put = function(key, value, time) {
if (debug) console.log('caching: '+key+' = '+value+' (@'+time+')');
var oldRecord = cache[key];
- if(oldRecord) {
+ if (oldRecord) {
clearTimeout(oldRecord.timeout);
}
+ var expire = time + now();
var record = {value: value, expire: expire};
-
- var expire = time + now();
if (!isNaN(expire)) {
-
var timeout = setTimeout(function() {
exports.del(key);
}, time);
-
record.timeout = timeout;
}
View
@@ -41,7 +41,6 @@ setTimeout(function() {
console.log('Cache misses: ' + cache.misses());
}, 5000);
-
cache.put('timeout', 'timeout', 2000);
setTimeout(function() {
@@ -51,12 +50,4 @@ setTimeout(function() {
setTimeout(function() {
console.log('timeout-re == '+cache.get('timeout'));
-},3000);
-
-
-
-
-
-
-
-
+}, 3000);

0 comments on commit f7fa573

Please sign in to comment.