simple-in-memory-cache 0.1.0 → 0.2.1
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/README.md +2 -2
- package/changelog.md +21 -0
- package/dist/cache.d.ts +10 -9
- package/dist/cache.js.map +1 -1
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# simple-in-memory-cache
|
|
2
2
|
|
|
3
|
-

|
|
4
|
+

|
|
5
5
|
|
|
6
6
|
A simple in-memory cache, for nodejs and the browser, with time based expiration policies.
|
|
7
7
|
|
package/changelog.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
### [0.2.1](https://www.github.com/ehmpathy/simple-in-memory-cache/compare/v0.2.0...v0.2.1) (2022-11-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **cicd:** add test:format script to unblock ghactions ([f4f645c](https://www.github.com/ehmpathy/simple-in-memory-cache/commit/f4f645ce6ec9d44ea44a2f175f5fbcdddbacd45f))
|
|
9
|
+
|
|
10
|
+
## [0.2.0](https://www.github.com/ehmpathy/simple-in-memory-cache/compare/v0.1.0...v0.2.0) (2022-11-23)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **cicd:** add please release github cicd ([43f27ea](https://www.github.com/ehmpathy/simple-in-memory-cache/commit/43f27ea69477e5e3966b2eec3289f2f4d0d99dca))
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **remote:** replace references from uladkasach repo to ehmpathy repo ([983e8ac](https://www.github.com/ehmpathy/simple-in-memory-cache/commit/983e8ac3ae9eeb68cc6d63505d6c8ed851f69d57))
|
|
21
|
+
* **types:** expose a type for an instance of the cache ([1bcbf9b](https://www.github.com/ehmpathy/simple-in-memory-cache/commit/1bcbf9b9aa38934ce08f86e628938681d1dfd2ee))
|
package/dist/cache.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export interface SimpleInMemoryCache {
|
|
1
|
+
export interface SimpleInMemoryCache<T> {
|
|
2
|
+
get: (key: string) => T | undefined;
|
|
3
|
+
set: (key: string, value: T, options?: {
|
|
4
|
+
secondsUntilExpiration?: number;
|
|
5
|
+
}) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface SimpleInMemoryCacheState<T> {
|
|
2
8
|
[index: string]: {
|
|
3
|
-
value:
|
|
9
|
+
value: T;
|
|
4
10
|
expiresAtMse: number;
|
|
5
11
|
};
|
|
6
12
|
}
|
|
7
|
-
export declare const createCache: ({ defaultSecondsUntilExpiration }?: {
|
|
13
|
+
export declare const createCache: <T>({ defaultSecondsUntilExpiration }?: {
|
|
8
14
|
defaultSecondsUntilExpiration?: number | undefined;
|
|
9
|
-
}) =>
|
|
10
|
-
set: (key: string, value: any, { secondsUntilExpiration }?: {
|
|
11
|
-
secondsUntilExpiration?: number | undefined;
|
|
12
|
-
}) => void;
|
|
13
|
-
get: (key: string) => any;
|
|
14
|
-
};
|
|
15
|
+
}) => SimpleInMemoryCache<T>;
|
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":";;;AASA,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAEhC,QAAA,WAAW,GAAG,CAAI,EAAE,6BAA6B,GAAG,CAAC,GAAG,EAAE,KAAiD,EAAE,EAExH,EAAE;IACF,4CAA4C;IAC5C,MAAM,KAAK,GAAgC,EAAE,CAAC;IAE9C,2CAA2C;IAC3C,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,KAAQ,EAAE,EAAE,sBAAsB,GAAG,6BAA6B,KAA0C,EAAE,EAAE,EAAE;QAC1I,MAAM,YAAY,GAAG,SAAS,EAAE,GAAG,sBAAsB,GAAG,IAAI,CAAC;QACjE,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC;IACvC,CAAC,CAAC;IAEF,2CAA2C;IAC3C,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,EAAE;QAC1B,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,YAAY;YAAE,OAAO,SAAS,CAAC,CAAC,kCAAkC;QACvE,IAAI,YAAY,CAAC,YAAY,GAAG,SAAS,EAAE;YAAE,OAAO,SAAS,CAAC,CAAC,qCAAqC;QACpG,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,mEAAmE;IAChG,CAAC,CAAC;IAEF,iBAAiB;IACjB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AACtB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simple-in-memory-cache",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "A simple in-memory cache, for nodejs and the browser, with time based expiration policies.",
|
|
5
5
|
"author": "UladKasach @uladkasach",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "uladkasach/simple-in-memory-cache",
|
|
8
|
-
"homepage": "https://github.com/
|
|
8
|
+
"homepage": "https://github.com/ehmpathy/simple-in-memory-cache",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"cache",
|
|
11
11
|
"memory",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"ttl",
|
|
21
21
|
"expiration"
|
|
22
22
|
],
|
|
23
|
-
"bugs": "https://github.com/
|
|
23
|
+
"bugs": "https://github.com/ehmpathy/simple-in-memory-cache/issues",
|
|
24
24
|
"main": "dist/index.js",
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=8.0.0"
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"build:ts": "tsc -p ./tsconfig.build.json",
|
|
34
34
|
"build": "npm run build:clean && npm run build:ts",
|
|
35
35
|
"test:types": "tsc --noEmit",
|
|
36
|
+
"test:format": "prettier --parser typescript --check 'src/**/*.ts' --config ./prettier.config.js",
|
|
36
37
|
"test:lint": "eslint -c ./.eslintrc.js src/**/*.ts",
|
|
37
38
|
"test:unit": "jest --forceExit --verbose --passWithNoTests",
|
|
38
39
|
"test:integration": "jest -c ./jest.integration.config.js --forceExit --verbose --passWithNoTests",
|