Comparing version 3.0.3 to 3.1.0
@@ -0,1 +1,8 @@ | ||
# [3.1.0](https://github.com/TinkoffCreditSystems/cachalot/compare/v3.0.3...v3.1.0) (2020-08-01) | ||
### Features | ||
* make cachalot free from dependencies ([fc54e6c](https://github.com/TinkoffCreditSystems/cachalot/commit/fc54e6c)) | ||
## [3.0.3](https://github.com/TinkoffCreditSystems/cachalot/compare/v3.0.2...v3.0.3) (2020-06-24) | ||
@@ -2,0 +9,0 @@ |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.EXPIRES_IN = exports.isBaseStorageOptions = exports.isCustomStorageOptions = void 0; | ||
const defaultsDeep_1 = __importDefault(require("lodash/defaultsDeep")); | ||
const ConnectionStatus_1 = require("./ConnectionStatus"); | ||
@@ -71,4 +70,4 @@ const Executor_1 = require("./Executor"); | ||
} | ||
const { manager: managerName = RefreshAheadManager_1.default.getName() } = options; | ||
const computedOptions = defaultsDeep_1.default({}, options, { expiresIn: this.expiresIn }); | ||
const { manager: managerName = RefreshAheadManager_1.default.getName(), expiresIn = this.expiresIn } = options; | ||
const computedOptions = { ...options, expiresIn }; | ||
const manager = this.getManager(managerName); | ||
@@ -81,4 +80,4 @@ return manager.get(key, executor, computedOptions); | ||
async set(key, value, options = {}) { | ||
const { manager: managerName = RefreshAheadManager_1.default.getName() } = options; | ||
const computedOptions = defaultsDeep_1.default({}, options, { expiresIn: this.expiresIn }); | ||
const { manager: managerName = RefreshAheadManager_1.default.getName(), expiresIn = this.expiresIn } = options; | ||
const computedOptions = { ...options, expiresIn }; | ||
const manager = this.getManager(managerName); | ||
@@ -85,0 +84,0 @@ return manager.set(key, value, computedOptions); |
@@ -12,3 +12,2 @@ "use strict"; | ||
const Record_1 = require("./Record"); | ||
const differenceWith_1 = __importDefault(require("lodash/differenceWith")); | ||
exports.TAGS_VERSIONS_ALIAS = "cache-tags-versions"; | ||
@@ -18,2 +17,8 @@ function uniq(arr) { | ||
} | ||
function tagVersionByName(tags) { | ||
return tags.reduce((acc, tag) => { | ||
acc[tag.name] = tag.version; | ||
return acc; | ||
}, {}); | ||
} | ||
/** | ||
@@ -142,5 +147,9 @@ * BaseStorage is the default Storage implementation for Manager. | ||
} | ||
const isTagOutdatedComparator = (recordTag, actualTag) => recordTag.name === actualTag.name && recordTag.version >= actualTag.version; | ||
const diff = differenceWith_1.default(record.tags, actualTags, isTagOutdatedComparator); | ||
return diff.length !== 0; | ||
// if no tag touched, record is not outdated | ||
if (actualTags.length === 0) { | ||
return false; | ||
} | ||
const recordTags = tagVersionByName(record.tags); | ||
// at least one actualTag should have greater version | ||
return actualTags.some(actualTag => actualTag.version > recordTags[actualTag.name]); | ||
} | ||
@@ -147,0 +156,0 @@ return false; |
{ | ||
"name": "cachalot", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "Cache manager for nodejs with support different cache strategies", | ||
@@ -40,5 +40,3 @@ "keywords": [ | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.17.15" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": { | ||
@@ -49,3 +47,2 @@ "@semantic-release/changelog": "^3.0.4", | ||
"@types/jest": "^25.2.3", | ||
"@types/lodash": "^4.14.157", | ||
"@types/memcached": "^2.2.6", | ||
@@ -66,3 +63,3 @@ "@types/node": "^8.10.61", | ||
"ts-jest": "^25.5.1", | ||
"typescript": "^3.9.5", | ||
"typescript": "^3.9.7", | ||
"uuid": "^8.2.0" | ||
@@ -69,0 +66,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
139370
0
21
1995
- Removedlodash@^4.17.15
- Removedlodash@4.17.21(transitive)