Comparing version 1.1.5 to 1.1.6
{ | ||
"name": "onionskin", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Tadeu Zagallo <tadeuzagallo@gmail.com>" |
{ | ||
"name": "onionskin", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Multilayer Cache Manager for JavaScript", | ||
@@ -38,3 +38,3 @@ "main": "src/onionskin.js", | ||
"dependencies": { | ||
"bluebird": "~2.2.0" | ||
"bluebird": "~2.3.11" | ||
}, | ||
@@ -41,0 +41,0 @@ "testling": { |
@@ -40,20 +40,22 @@ var Promise = require('bluebird'); | ||
return item.get(cachePolicy, policyData).then(function (data) { | ||
return item.isMiss().then(function (missed) { | ||
if (missed) { | ||
item.lock(); | ||
if (!generator) { | ||
throw 'Cache is missing'; | ||
} | ||
return Promise.props({ | ||
data: item.get(cachePolicy, policyData), | ||
missed: item.isMiss() | ||
}).then(function (result) { | ||
if (result.missed) { | ||
item.lock(); | ||
return Promise.try(generator) | ||
.then(function (val) { | ||
return item.save(val); | ||
}).catch(function () { | ||
return item.unlock(); | ||
}); | ||
} else { | ||
return data; | ||
if (!generator) { | ||
throw 'Cache is missing'; | ||
} | ||
}); | ||
return Promise.try(generator) | ||
.then(function (val) { | ||
return item.save(val); | ||
}).catch(function () { | ||
return item.unlock(); | ||
}); | ||
} else { | ||
return result.data; | ||
} | ||
}).bind(item); | ||
@@ -60,0 +62,0 @@ }; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1789317
7061
+ Addedbluebird@2.3.11(transitive)
- Removedbluebird@2.2.2(transitive)
Updatedbluebird@~2.3.11