simple-in-memory-cache 0.1.0 → 0.2.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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # simple-in-memory-cache
2
2
 
3
- ![ci_on_commit](https://github.com/uladkasach/simple-in-memory-cache/workflows/ci_on_commit/badge.svg)
4
- ![deploy_on_tag](https://github.com/uladkasach/simple-in-memory-cache/workflows/deploy_on_tag/badge.svg)
3
+ ![ci_on_commit](https://github.com/ehmpathy/simple-in-memory-cache/workflows/ci_on_commit/badge.svg)
4
+ ![deploy_on_tag](https://github.com/ehmpathy/simple-in-memory-cache/workflows/deploy_on_tag/badge.svg)
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,14 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0](https://www.github.com/ehmpathy/simple-in-memory-cache/compare/v0.1.0...v0.2.0) (2022-11-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * **cicd:** add please release github cicd ([43f27ea](https://www.github.com/ehmpathy/simple-in-memory-cache/commit/43f27ea69477e5e3966b2eec3289f2f4d0d99dca))
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **remote:** replace references from uladkasach repo to ehmpathy repo ([983e8ac](https://www.github.com/ehmpathy/simple-in-memory-cache/commit/983e8ac3ae9eeb68cc6d63505d6c8ed851f69d57))
14
+ * **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: any;
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":";;;AAIA,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;AAEhC,QAAA,WAAW,GAAG,CAAC,EAAE,6BAA6B,GAAG,CAAC,GAAG,EAAE,KAAiD,EAAE,EAAE,EAAE;IACzH,4CAA4C;IAC5C,MAAM,KAAK,GAAwB,EAAE,CAAC;IAEtC,2CAA2C;IAC3C,MAAM,GAAG,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE,sBAAsB,GAAG,6BAA6B,KAA0C,EAAE,EAAE,EAAE;QAC5I,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"}
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.0",
3
+ "version": "0.2.0",
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/uladkasach/simple-in-memory-cache",
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/uladkasach/simple-in-memory-cache/issues",
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"