simple-in-memory-cache 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cache.d.ts +7 -18
- package/dist/cache.js +4 -6
- package/dist/cache.js.map +1 -1
- package/dist/cache.test.js +5 -20
- package/dist/cache.test.js.map +1 -1
- package/package.json +23 -17
- package/LICENSE +0 -21
package/dist/cache.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { UniDuration } from '@ehmpathy/uni-time';
|
|
2
2
|
export interface SimpleInMemoryCache<T> {
|
|
3
3
|
get: (key: string) => T | undefined;
|
|
4
|
-
set: (key: string, value: T, options?:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}>>) => void;
|
|
4
|
+
set: (key: string, value: T, options?: {
|
|
5
|
+
expiration?: UniDuration | null;
|
|
6
|
+
}) => void;
|
|
8
7
|
keys: () => string[];
|
|
9
8
|
}
|
|
10
9
|
export interface SimpleInMemoryCacheState<T> {
|
|
@@ -13,16 +12,6 @@ export interface SimpleInMemoryCacheState<T> {
|
|
|
13
12
|
expiresAtMse: number;
|
|
14
13
|
};
|
|
15
14
|
}
|
|
16
|
-
export declare const createCache: <T>({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
defaultSecondsUntilExpiration?: number | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* a shorthand alias for `defaultSecondsUntilExpiration`
|
|
23
|
-
*
|
|
24
|
-
* note
|
|
25
|
-
* - if both options are set, `defaultSecondsUntilExpirationInput` takes precedence
|
|
26
|
-
*/
|
|
27
|
-
seconds?: number | undefined;
|
|
28
|
-
}>>) => SimpleInMemoryCache<T>;
|
|
15
|
+
export declare const createCache: <T>({ expiration: defaultExpiration, }?: {
|
|
16
|
+
expiration?: UniDuration | null;
|
|
17
|
+
}) => SimpleInMemoryCache<T>;
|
package/dist/cache.js
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createCache = void 0;
|
|
4
|
+
const uni_time_1 = require("@ehmpathy/uni-time");
|
|
4
5
|
const getMseNow = () => new Date().getTime();
|
|
5
|
-
const createCache = ({
|
|
6
|
-
var _a;
|
|
7
|
-
// resolve input alias
|
|
8
|
-
const defaultSecondsUntilExpiration = (_a = defaultSecondsUntilExpirationInput !== null && defaultSecondsUntilExpirationInput !== void 0 ? defaultSecondsUntilExpirationInput : seconds) !== null && _a !== void 0 ? _a : 5 * 60;
|
|
6
|
+
const createCache = ({ expiration: defaultExpiration, } = { expiration: { minutes: 5 } }) => {
|
|
9
7
|
// initialize a fresh in-memory cache object
|
|
10
8
|
const cache = {};
|
|
11
9
|
// define how to set an item into the cache
|
|
12
|
-
const set = (key, value, {
|
|
10
|
+
const set = (key, value, { expiration = defaultExpiration, } = {}) => {
|
|
13
11
|
// handle cache invalidation
|
|
14
12
|
if (value === undefined) {
|
|
15
13
|
delete cache[key];
|
|
16
14
|
return;
|
|
17
15
|
}
|
|
18
16
|
// handle setting
|
|
19
|
-
const expiresAtMse = getMseNow() +
|
|
17
|
+
const expiresAtMse = getMseNow() + (expiration ? (0, uni_time_1.toMilliseconds)(expiration) : Infinity); // infinity if null
|
|
20
18
|
cache[key] = { value, expiresAtMse };
|
|
21
19
|
};
|
|
22
20
|
// define how to get an item from the cache
|
package/dist/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":";;;AAAA,iDAAiE;AAgBjE,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAEtC,MAAM,WAAW,GAAG,CACzB,EACE,UAAU,EA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AE,CAAC,GAAG,CAAC,CAAC;IAEzB,iBAAiB;IACjB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC,CAAC;AA9CW,QAAA,WAAW,eA8CtB"}
|
package/dist/cache.test.js
CHANGED
|
@@ -24,22 +24,7 @@ describe('cache', () => {
|
|
|
24
24
|
expect(licks).toEqual(3);
|
|
25
25
|
});
|
|
26
26
|
it('should respect the default expiration for the cache', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
27
|
-
const { set, get } = (0, cache_1.createCache)({
|
|
28
|
-
set('how popped is the popcorn?', 'not popped');
|
|
29
|
-
// prove that we recorded the value and its accessible immediately after setting
|
|
30
|
-
const popcornStatus = get('how popped is the popcorn?');
|
|
31
|
-
expect(popcornStatus).toEqual('not popped');
|
|
32
|
-
// prove that the value is still accessible after 9 seconds, since default ttl is 10 seconds
|
|
33
|
-
yield sleep(9 * 1000);
|
|
34
|
-
const popcornStatusAfter9Sec = get('how popped is the popcorn?');
|
|
35
|
-
expect(popcornStatusAfter9Sec).toEqual('not popped'); // still should say not popped
|
|
36
|
-
// and prove that after a total of 9 seconds, the status is no longer in the cache
|
|
37
|
-
yield sleep(1 * 1000); // sleep 1 more second
|
|
38
|
-
const popcornStatusAfter10Sec = get('how popped is the popcorn?');
|
|
39
|
-
expect(popcornStatusAfter10Sec).toEqual(undefined); // no longer defined, since the default seconds until expiration was 15
|
|
40
|
-
}));
|
|
41
|
-
it('should respect the default expiration for the cache set by shorthand alias', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
42
|
-
const { set, get } = (0, cache_1.createCache)({ seconds: 10 }); // we're gonna use this cache to keep track of the popcorn in the microwave - we should check more regularly since it changes quickly!
|
|
27
|
+
const { set, get } = (0, cache_1.createCache)({ expiration: { seconds: 10 } }); // we're gonna use this cache to keep track of the popcorn in the microwave - we should check more regularly since it changes quickly!
|
|
43
28
|
set('how popped is the popcorn?', 'not popped');
|
|
44
29
|
// prove that we recorded the value and its accessible immediately after setting
|
|
45
30
|
const popcornStatus = get('how popped is the popcorn?');
|
|
@@ -55,7 +40,7 @@ describe('cache', () => {
|
|
|
55
40
|
}));
|
|
56
41
|
it('should respect the item level expiration for the cache', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
57
42
|
const { set, get } = (0, cache_1.createCache)(); // remember, default expiration is greater than 1 min
|
|
58
|
-
set('ice cream state', 'solid', {
|
|
43
|
+
set('ice cream state', 'solid', { expiration: { seconds: 5 } }); // ice cream changes quickly in the heat! lets keep a quick eye on this
|
|
59
44
|
// prove that we recorded the value and its accessible immediately after setting
|
|
60
45
|
const iceCreamState = get('ice cream state');
|
|
61
46
|
expect(iceCreamState).toEqual('solid');
|
|
@@ -68,9 +53,9 @@ describe('cache', () => {
|
|
|
68
53
|
const iceCreamStateAfter5Sec = get('ice cream state');
|
|
69
54
|
expect(iceCreamStateAfter5Sec).toEqual(undefined); // no longer defined, since the item level seconds until expiration was 5
|
|
70
55
|
}));
|
|
71
|
-
it('should consider secondsUntilExpiration of null
|
|
56
|
+
it('should consider secondsUntilExpiration of null as never expiring', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
57
|
const { set, get } = (0, cache_1.createCache)({
|
|
73
|
-
|
|
58
|
+
expiration: { seconds: 0 }, // expire immediately
|
|
74
59
|
});
|
|
75
60
|
// prove that setting something to the cache with default state will have it expired immediately
|
|
76
61
|
yield set('dory-memory', 'something'); // lets see if dory can remember something
|
|
@@ -78,7 +63,7 @@ describe('cache', () => {
|
|
|
78
63
|
expect(doryMemory).toEqual(undefined); // its already gone! dang default expiration
|
|
79
64
|
// prove that if we record the memory with expires-at Infinity, it persists
|
|
80
65
|
yield set('elephant-memory', 'something', {
|
|
81
|
-
|
|
66
|
+
expiration: null,
|
|
82
67
|
});
|
|
83
68
|
const elephantMemory = yield get('elephant-memory');
|
|
84
69
|
expect(elephantMemory).toEqual('something');
|
package/dist/cache.test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.test.js","sourceRoot":"","sources":["../src/cache.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAsC;AAEtC,IAAI,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,kGAAkG;AAE9H,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAEhF,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAA,mBAAW,GAAE,CAAC;QAC9B,GAAG,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;IAC7B,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAA,mBAAW,GAAE,CAAC;QACnC,GAAG,CACD,oEAAoE,EACpE,CAAC,CACF,CAAC;QACF,MAAM,KAAK,GAAG,GAAG,CACf,oEAAoE,CACrE,CAAC;QACF,MAAM,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qDAAqD,EAAE,GAAS,EAAE;QACnE,MAAM,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAA,mBAAW,EAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"cache.test.js","sourceRoot":"","sources":["../src/cache.test.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mCAAsC;AAEtC,IAAI,CAAC,UAAU,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,kGAAkG;AAE9H,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,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E5C,sCAAsC;QACtC,GAAG,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;QAE5C,0CAA0C;QAC1C,GAAG,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAChC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "simple-in-memory-cache",
|
|
3
3
|
"author": "ehmpathy",
|
|
4
4
|
"description": "A simple in-memory cache, for nodejs and the browser, with time based expiration policies.",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.4.0",
|
|
6
6
|
"repository": "ehmpathy/simple-in-memory-cache",
|
|
7
7
|
"homepage": "https://github.com/ehmpathy/simple-in-memory-cache",
|
|
8
8
|
"keywords": [
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"expiration"
|
|
21
21
|
],
|
|
22
22
|
"bugs": "https://github.com/ehmpathy/simple-in-memory-cache/issues",
|
|
23
|
+
"license": "MIT",
|
|
23
24
|
"main": "dist/index.js",
|
|
24
25
|
"engines": {
|
|
25
26
|
"node": ">=8.0.0"
|
|
@@ -43,45 +44,50 @@
|
|
|
43
44
|
"test:lint:deps": "npx depcheck -c ./depcheckrc.yml",
|
|
44
45
|
"test:lint:eslint": "eslint -c ./.eslintrc.js src/**/*.ts",
|
|
45
46
|
"test:lint": "npm run test:lint:eslint && npm run test:lint:deps",
|
|
46
|
-
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests",
|
|
47
|
-
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests",
|
|
47
|
+
"test:unit": "jest -c ./jest.unit.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main')",
|
|
48
|
+
"test:integration": "jest -c ./jest.integration.config.ts --forceExit --verbose --passWithNoTests $([ -z $THOROUGH ] && echo '--changedSince=main')",
|
|
48
49
|
"test:acceptance:locally": "npm run build && LOCALLY=true jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
|
|
49
50
|
"test": "npm run test:commits && npm run test:types && npm run test:format && npm run test:lint && npm run test:unit && npm run test:integration && npm run test:acceptance:locally",
|
|
50
51
|
"test:acceptance": "npm run build && jest -c ./jest.acceptance.config.ts --forceExit --verbose --runInBand --passWithNoTests",
|
|
51
52
|
"prepush": "npm run test && npm run build",
|
|
52
53
|
"prepublish": "npm run build",
|
|
53
54
|
"preversion": "npm run prepush",
|
|
54
|
-
"postversion": "git push origin HEAD --tags --no-verify"
|
|
55
|
+
"postversion": "git push origin HEAD --tags --no-verify",
|
|
56
|
+
"prepare:husky": "npx husky install && chmod ug+x .husky/*",
|
|
57
|
+
"postinstall": "[ -d .git ] && npm run prepare:husky || exit 0"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
60
|
+
"@commitlint/cli": "19.3.0",
|
|
57
61
|
"@commitlint/config-conventional": "13.1.0",
|
|
58
|
-
"@trivago/prettier-plugin-sort-imports": "
|
|
62
|
+
"@trivago/prettier-plugin-sort-imports": "4.3.0",
|
|
59
63
|
"@tsconfig/node-lts-strictest": "18.12.1",
|
|
60
64
|
"@types/jest": "29.2.4",
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "
|
|
62
|
-
"@typescript-eslint/parser": "
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "7.8.0",
|
|
66
|
+
"@typescript-eslint/parser": "7.8.0",
|
|
63
67
|
"commitlint": "^17.6.7",
|
|
64
68
|
"core-js": "3.26.1",
|
|
65
69
|
"cz-conventional-changelog": "3.3.0",
|
|
66
|
-
"declapract": "^0.11.
|
|
67
|
-
"declapract-typescript-ehmpathy": "^0.
|
|
70
|
+
"declapract": "^0.11.5",
|
|
71
|
+
"declapract-typescript-ehmpathy": "^0.35.5",
|
|
68
72
|
"depcheck": "1.4.3",
|
|
69
|
-
"eslint": "8.
|
|
70
|
-
"eslint-config-airbnb-typescript": "
|
|
73
|
+
"eslint": "8.56.0",
|
|
74
|
+
"eslint-config-airbnb-typescript": "18.0.0",
|
|
71
75
|
"eslint-config-prettier": "8.5.0",
|
|
72
76
|
"eslint-plugin-import": "2.26.0",
|
|
73
77
|
"eslint-plugin-prettier": "4.2.1",
|
|
74
|
-
"husky": "
|
|
75
|
-
"jest": "29.
|
|
78
|
+
"husky": "8.0.3",
|
|
79
|
+
"jest": "29.7.0",
|
|
76
80
|
"prettier": "2.8.1",
|
|
77
|
-
"ts-jest": "29.
|
|
78
|
-
"ts-node": "10.9.
|
|
79
|
-
"
|
|
80
|
-
"typescript": "4.9.4"
|
|
81
|
+
"ts-jest": "29.2.5",
|
|
82
|
+
"ts-node": "10.9.2",
|
|
83
|
+
"typescript": "5.4.5"
|
|
81
84
|
},
|
|
82
85
|
"config": {
|
|
83
86
|
"commitizen": {
|
|
84
87
|
"path": "./node_modules/cz-conventional-changelog"
|
|
85
88
|
}
|
|
89
|
+
},
|
|
90
|
+
"dependencies": {
|
|
91
|
+
"@ehmpathy/uni-time": "^1.7.4"
|
|
86
92
|
}
|
|
87
93
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2020 Uladzimir Kasacheuski
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|