Skip to content
Myr

Fixed Cache Store.Memory usage of Object#reduce()

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

authored by visionmedia · committed by visionmedia · parent 760d9e3 · Browse files · 1 file+7 added−6 removed
This commit

State

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

Diff stats

1 file+7 added−6 removed

  • other:+7 added−6 removed

1 file+7 added−6 removed

modified:lib/express/plugins/cache.js+7 added-6 removed
124 unmodified lines
125 if (key.indexOf('*') === -1)126 return callback(this.data[key] instanceof Cache127 ? this.data[key].val128 : null)129 var regexp = this.normalize(key) 130 callback(this.data.reduce(function(vals, cache){131 if (regexp.test(cache.key))132 vals[cache.key] = cache.val133 return vals134 }, {}))129 var regexp = this.normalize(key),130 keys = Object.keys(this.data),131 matches = {}132 for (var i = 0, len = keys.length; i < len; ++i)133 if (regexp.test(keys[i]))134 matches[keys[i]] = this.data[keys[i]]135 return matches136 },137 138 /**139 * Clear data matching the given _key_.
93 unmodified lines