koa-incache
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -7,2 +7,6 @@ # Change Log | ||
## [0.3.0] - 2017-09-07 | ||
- Updated dependencies | ||
- Minor improvement | ||
## [0.2.0] - 2017-08-22 | ||
@@ -9,0 +13,0 @@ - Updated readme |
14
index.js
@@ -30,11 +30,11 @@ const InCache = require('incache'); | ||
const config = defaulty(opts, defaultConfig); | ||
defaulty(opts, defaultConfig); | ||
if(config.life) { | ||
config.maxAge = config.life * 1000; | ||
/* istanbul ignore if */ | ||
if(opts.life) { | ||
opts.maxAge = opts.life * 1000; | ||
} | ||
// One configuration | ||
const incacheConfig = deleteKey( | ||
Object.assign({}, config), | ||
const incacheConfig = deleteKey.copy(opts, | ||
['life','cachedProperty', 'onReadCache'] | ||
@@ -74,4 +74,4 @@ ); | ||
if (cached !== null) { | ||
config.onReadCache.call(this, key, cached); | ||
if (typeof cached !== 'undefined') { | ||
opts.onReadCache.call(this, key, cached); | ||
return ctx.body = cached; | ||
@@ -78,0 +78,0 @@ } |
{ | ||
"name": "koa-incache", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Koa cache middleware", | ||
@@ -47,9 +47,9 @@ "main": "index.js", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"request": "^2.81.0" | ||
"supertest": "^3.0.0" | ||
}, | ||
"dependencies": { | ||
"defaulty": "^1.1.0", | ||
"delete-key": "^1.0.2", | ||
"incache": "^4.0.2" | ||
"defaulty": "^1.2.1", | ||
"delete-key": "^1.1.0", | ||
"incache": "^5.2.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
65533
16
+ Addedflak@0.3.1(transitive)
+ Addedincache@5.2.0(transitive)
+ Addeduuid@3.4.0(transitive)
- Removedincache@4.2.1(transitive)
Updateddefaulty@^1.2.1
Updateddelete-key@^1.1.0
Updatedincache@^5.2.0