YUKI Hiroshi
null+****@clear*****
Thu Mar 20 18:40:46 JST 2014
YUKI Hiroshi 2014-03-20 18:40:46 +0900 (Thu, 20 Mar 2014) New Revision: d31fd6b9438b41242e3687dc9498ef9f0c9b505c https://github.com/droonga/express-droonga/commit/d31fd6b9438b41242e3687dc9498ef9f0c9b505c Message: Fallback to the clobal TTL correctly Modified files: lib/response-cache/cache.js Modified: lib/response-cache/cache.js (+9 -7) =================================================================== --- lib/response-cache/cache.js 2014-03-20 18:36:05 +0900 (0f3703b) +++ lib/response-cache/cache.js 2014-03-20 18:40:46 +0900 (682739c) @@ -4,12 +4,12 @@ var Rule = require('./rule'); var defaultSize = 100; var defaultTTLInMilliSeconds = 60 * 1000; -function normalizeTTLOption(options) { +function getNormalizedTTLInMilliSeconds(options) { var ttlInSeconds = options.ttlInSeconds || 0; - options.ttlInMilliSeconds = options.ttl || - options.ttlInMilliSeconds || - (ttlInSeconds * 1000) || - defaultTTLInMilliSeconds; + return options.ttl || + options.ttlInMilliSeconds || + (ttlInSeconds * 1000) || + 0; } function normalizeOptions(options) { @@ -22,10 +22,12 @@ function normalizeOptions(options) { throw new Error('you must specify one or more rules'); options.size = options.size || defaultSize; - normalizeTTLOption(options); + options.ttlInMilliSeconds = getNormalizedTTLInMilliSeconds(options) || + defaultTTLInMilliSeconds; options.rules = options.rules.map(function(rule) { - normalizeTTLOption(rule); + rule.ttlInMilliSeconds = getNormalizedTTLInMilliSeconds(rule) || + options.ttlInMilliSeconds; return new Rule(rule, options); }); -------------- next part -------------- HTML����������������������������...Download