appolo-cache
Advanced tools
Comparing version 6.0.6 to 6.0.7
@@ -40,11 +40,11 @@ import {ListItem} from "./listItem"; | ||
public getByExpire(key: K, expire?: number): { value: T, validExpire: boolean } { | ||
return this._getByExpire(key, expire, "getItem"); | ||
public getByExpire(key: K, expire?: number, refresh?: number): { value: T, validExpire: boolean } { | ||
return this._getByExpire(key, expire, refresh, "getItem"); | ||
} | ||
public peekByExpire(key: K, expire?: number): { value: T, validExpire: boolean } { | ||
return this._getByExpire(key, expire, "peekItem"); | ||
public peekByExpire(key: K, expire?: number, refresh?: number): { value: T, validExpire: boolean } { | ||
return this._getByExpire(key, expire, refresh, "peekItem"); | ||
} | ||
private _getByExpire(key: K, expire: number, action: "peekItem" | "getItem"): { value: T, validExpire: boolean } { | ||
private _getByExpire(key: K, expire: number, refresh: number, action: "peekItem" | "getItem"): { value: T, validExpire: boolean } { | ||
let item = this[action](key); | ||
@@ -57,2 +57,3 @@ | ||
expire = expire || item.maxAge; | ||
refresh = refresh || (expire / 2) | ||
@@ -63,3 +64,3 @@ let ttl = item.ttl; | ||
value: item.value, | ||
validExpire: ttl >= (expire / 2) | ||
validExpire: ttl >= refresh | ||
}; | ||
@@ -310,2 +311,2 @@ | ||
} | ||
} |
@@ -21,3 +21,3 @@ { | ||
"main": "./index.js", | ||
"version": "6.0.6", | ||
"version": "6.0.7", | ||
"license": "MIT", | ||
@@ -33,11 +33,11 @@ "repository": { | ||
"@types/benchmark": "^1.0.31", | ||
"@types/chai": "^4.1.2", | ||
"@types/mocha": "^5.0.0", | ||
"@types/chai": "^4.2.11", | ||
"@types/mocha": "^7.0.2", | ||
"benchmark": "^2.1.4", | ||
"chai": "^4.1.2", | ||
"lru-cache": "^4.1.2", | ||
"mocha": "^5.0.5", | ||
"chai": "^4.2.0", | ||
"lru-cache": "^5.1.1", | ||
"mocha": "^7.1.2", | ||
"simple-lru-cache": "0.0.2", | ||
"typescript": "^2.8.1" | ||
"typescript": "^3.8.3" | ||
} | ||
} |
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
669
21448
12