@thi.ng/cache 2.3.11 → 2.3.13

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/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change Log
2
2
 
3
- - **Last updated**: 2024-10-05T12:12:32Z
3
+ - **Last updated**: 2024-11-10T17:11:51Z
4
4
  - **Generator**: [thi.ng/monopub](https://thi.ng/monopub)
5
5
 
6
6
  All notable changes to this project will be documented in this file.
@@ -9,6 +9,12 @@ See [Conventional Commits](https://conventionalcommits.org/) for commit guidelin
9
9
  **Note:** Unlisted _patch_ versions only involve non-code or otherwise excluded changes
10
10
  and/or version bumps of transitive dependencies.
11
11
 
12
+ ### [2.3.12](https://github.com/thi-ng/umbrella/tree/@thi.ng/cache@2.3.12) (2024-10-31)
13
+
14
+ #### ♻️ Refactoring
15
+
16
+ - add MapLike interface to loosen Map impls ([603c76c](https://github.com/thi-ng/umbrella/commit/603c76c))
17
+
12
18
  ## [2.3.0](https://github.com/thi-ng/umbrella/tree/@thi.ng/cache@2.3.0) (2024-07-28)
13
19
 
14
20
  #### 🚀 Features
package/api.d.ts CHANGED
@@ -80,7 +80,7 @@ export interface CacheOpts<K, V> {
80
80
  * Custom ES6 Map compatible implementation to use as the cache's backing
81
81
  * store.
82
82
  */
83
- map: Fn0<Map<K, any>>;
83
+ map: Fn0<MapLike<K, any>>;
84
84
  /**
85
85
  * Max number of items in the cache.
86
86
  */
@@ -96,4 +96,14 @@ export interface CacheEntry<K, V> {
96
96
  v: V;
97
97
  s: number;
98
98
  }
99
+ /**
100
+ * Simplified subset of the ES6 Map API needed for cache implementations.
101
+ */
102
+ export interface MapLike<K, V> {
103
+ has(key: K): boolean;
104
+ get(key: K): Maybe<V>;
105
+ set(key: K, val: V): void;
106
+ delete(key: K): void;
107
+ clear(): void;
108
+ }
99
109
  //# sourceMappingURL=api.d.ts.map
package/lru.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { Fn0, Maybe, Nullable } from "@thi.ng/api";
2
2
  import type { ConsCell } from "@thi.ng/dcons";
3
3
  import { DCons } from "@thi.ng/dcons/dcons";
4
- import type { CacheEntry, CacheOpts, ICache } from "./api.js";
4
+ import type { CacheEntry, CacheOpts, ICache, MapLike } from "./api.js";
5
5
  export declare class LRUCache<K, V> implements ICache<K, V> {
6
- protected map: Map<K, ConsCell<CacheEntry<K, V>>>;
6
+ protected map: MapLike<K, ConsCell<CacheEntry<K, V>>>;
7
7
  protected items: DCons<CacheEntry<K, V>>;
8
8
  protected opts: CacheOpts<K, V>;
9
9
  protected _size: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thi.ng/cache",
3
- "version": "2.3.11",
3
+ "version": "2.3.13",
4
4
  "description": "In-memory cache implementations with ES6 Map-like API and different eviction strategies",
5
5
  "type": "module",
6
6
  "module": "./index.js",
@@ -28,7 +28,7 @@
28
28
  "build:decl": "tsc --declaration --emitDeclarationOnly",
29
29
  "build:esbuild": "esbuild --format=esm --platform=neutral --target=es2022 --tsconfig=tsconfig.json --outdir=. src/**/*.ts",
30
30
  "clean": "bun ../../tools/src/clean-package.ts",
31
- "doc": "typedoc --excludePrivate --excludeInternal --out doc src/index.ts",
31
+ "doc": "typedoc --options ../../typedoc.json --out doc src/index.ts",
32
32
  "doc:ae": "mkdir -p .ae/doc .ae/temp && api-extractor run --local --verbose",
33
33
  "doc:readme": "bun ../../tools/src/module-stats.ts && bun ../../tools/src/readme.ts",
34
34
  "pub": "yarn npm publish --access public",
@@ -36,8 +36,8 @@
36
36
  "tool:tangle": "../../node_modules/.bin/tangle src/**/*.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@thi.ng/api": "^8.11.11",
40
- "@thi.ng/dcons": "^3.2.131"
39
+ "@thi.ng/api": "^8.11.12",
40
+ "@thi.ng/dcons": "^3.2.132"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@microsoft/api-extractor": "^7.47.9",
@@ -89,5 +89,5 @@
89
89
  ],
90
90
  "year": 2018
91
91
  },
92
- "gitHead": "8301254c4436505a1fb0e3cc28eca3adb920c3e0\n"
92
+ "gitHead": "ef89090bb19fc5bca23be5da8cfce05b82ff4ad1\n"
93
93
  }
package/tlru.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { Fn0, Maybe, Nullable } from "@thi.ng/api";
2
2
  import type { ConsCell, DCons } from "@thi.ng/dcons";
3
- import type { CacheEntry, CacheOpts } from "./api.js";
3
+ import type { CacheEntry, CacheOpts, MapLike } from "./api.js";
4
4
  import { LRUCache } from "./lru.js";
5
5
  export interface TLRUCacheOpts<K, V> extends CacheOpts<K, V> {
6
6
  /**
@@ -47,7 +47,7 @@ export interface TLRUCacheEntry<K, V> extends CacheEntry<K, V> {
47
47
  */
48
48
  export declare class TLRUCache<K, V> extends LRUCache<K, V> {
49
49
  protected opts: TLRUCacheOpts<K, V>;
50
- protected map: Map<K, ConsCell<TLRUCacheEntry<K, V>>>;
50
+ protected map: MapLike<K, ConsCell<TLRUCacheEntry<K, V>>>;
51
51
  protected items: DCons<TLRUCacheEntry<K, V>>;
52
52
  constructor(pairs?: Nullable<Iterable<[K, V]>>, opts?: Partial<TLRUCacheOpts<K, V>>);
53
53
  empty(): TLRUCache<K, V>;