@5app/memoize
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -0,1 +1,8 @@ | ||
# [1.3.0](https://github.com/5app/memoize/compare/v1.2.0...v1.3.0) (2021-02-16) | ||
### Features | ||
* **cache:** Disable Env Var MEMOIZE_DISABLE ([408170e](https://github.com/5app/memoize/commit/408170e8cbb9a4e888652b5453d825f4f25c0a5b)) | ||
# [1.2.0](https://github.com/5app/memoize/compare/v1.1.0...v1.2.0) (2020-07-30) | ||
@@ -2,0 +9,0 @@ |
@@ -24,2 +24,5 @@ /** | ||
function Memoize(callback, opts = {}) { | ||
// Disable all memoize | ||
const {MEMOIZE_DISABLED = false} = process.env; | ||
const { | ||
@@ -72,3 +75,3 @@ // useCached: Will return the last resolved cached value | ||
// Serve the cached value? | ||
if (item.value && shouldUseCache(item)) { | ||
if (item.value && !MEMOIZE_DISABLED && shouldUseCache(item)) { | ||
// We're going to return the last resolved value | ||
@@ -75,0 +78,0 @@ // But first let's identify the next request |
{ | ||
"name": "@5app/memoize", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Memoize decorator", | ||
@@ -28,4 +28,4 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@commitlint/cli": "^9.0.0", | ||
"@commitlint/config-conventional": "^9.0.0", | ||
"@commitlint/cli": "^11.0.0", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@semantic-release/changelog": "^5.0.1", | ||
@@ -35,12 +35,12 @@ "@semantic-release/git": "^9.0.0", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^7.0.0", | ||
"eslint-config-5app": "^0.12.0", | ||
"eslint-config-prettier": "^6.11.0", | ||
"eslint-plugin-prettier": "^3.1.3", | ||
"husky": "^4.2.5", | ||
"mocha": "^8.0.0", | ||
"eslint": "^7.18.0", | ||
"eslint-config-5app": "^0.14.0", | ||
"eslint-config-prettier": "^7.2.0", | ||
"eslint-plugin-prettier": "^3.3.1", | ||
"husky": "^5.0.0", | ||
"mocha": "^8.2.1", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.0.0", | ||
"pretty-quick": "^2.0.1", | ||
"semantic-release": "^17.0.8" | ||
"prettier": "^2.2.1", | ||
"pretty-quick": "^3.1.0", | ||
"semantic-release": "^17.3.7" | ||
}, | ||
@@ -47,0 +47,0 @@ "publishConfig": { |
@@ -69,1 +69,11 @@ # Memoize | ||
``` | ||
# Globally Disable | ||
In testing to disable the memoize cache which can cause issues, use the `MEMOIZE_DISABLE` environment variable, e.g. | ||
```bash | ||
MEMOIZE_DISABLE=1 | ||
``` | ||
When set to a truthy value the memoize cache will be circumvented. |
11334
118
79