Skip to content
Myr

Utilizing Date.now()

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by visionmedia · committed by visionmedia · parent 8b58732 · Browse files · 3 files+8 added−8 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+8 added−8 removed

  • other:+8 added−8 removed

3 files+8 added−8 removed

modified:lib/express/plugins/cache.js+2 added-2 removed
16 unmodified lines
17 18 constructor: function(key, val) {19 this.key = key20 this.val = val21 this.created = Number(new Date)21 this.created = Date.now()22 }23})2425// --- Store
142 unmodified lines
168 */169 170 reap: function(ms, callback) {171 var self = this,172 threshold = Number(new Date(Number(new Date) - ms))172 threshold = +new Date(Date.now() - ms)173 this.data.each(function(cache){174 if (cache.created < threshold)175 self.clear(cache.key, function(){})176 })
58 unmodified lines
modified:lib/express/plugins/logger.js+4 added-4 removed
modified:lib/express/plugins/session.js+2 added-2 removed
26 unmodified lines
27 * @api private28 */29 30 touch: function() {31 this.lastAccess = Number(new Date)31 this.lastAccess = Date.now()32 }33})3435// --- Store
103 unmodified lines
139 * @api private140 */141 142 reap: function(ms, callback) {143 var threshold = Number(new Date(Number(new Date) - ms))143 var threshold = +new Date(Date.now() - ms)144 this.store.each(function(session, sid){145 if (session.lastAccess < threshold)146 this.destroy(sid)147 }, this)
87 unmodified lines