@nodellmcache/tiered 1.0.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/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @nodellmcache/tiered
2
+
3
+ ## 1.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Initial release of `@nodellmcache/tiered`: a `TieredAdapter` that composes several `StorageAdapter`s (fastest first, e.g. memory + Redis) into one. Read-through walks tiers fastest-first and promotes a slower-tier hit back into the faster tiers; writes/deletes/clear go to every tier; expired entries are skipped; `stats()` aggregates across tiers. It is itself a `StorageAdapter`, so it drops into any cache manager.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [a2633d8]
12
+ - @nodellmcache/core@1.0.0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NodeLLMCache contributors
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.
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @nodellmcache/tiered
2
+
3
+ Multi-tier storage adapter for [NodeLLMCache](https://github.com/mdmax007/node-llm-cache). Compose several `StorageAdapter`s into one, fastest first, with read-through promotion and write-through. The classic setup is L1 in-process memory plus L2 Redis: microsecond hits when hot, a shared durable tier when not.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @nodellmcache/tiered @nodellmcache/core
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```ts
14
+ import { PromptCache } from '@nodellmcache/prompt-cache'
15
+ import { TieredAdapter } from '@nodellmcache/tiered'
16
+ import { MemoryAdapter } from '@nodellmcache/memory'
17
+ import { RedisAdapter } from '@nodellmcache/redis'
18
+
19
+ const adapter = new TieredAdapter({
20
+ tiers: [
21
+ new MemoryAdapter({ maxSize: 64 * 1024 * 1024 }), // L1: fast, local
22
+ new RedisAdapter({ host: 'localhost', port: 6379 }), // L2: shared, durable
23
+ ],
24
+ })
25
+
26
+ const cache = new PromptCache({ adapter })
27
+ ```
28
+
29
+ ## Behavior
30
+
31
+ - **Read-through with promotion** — `get` walks the tiers fastest-first. On a hit in a slower tier, the entry is back-filled into the faster tiers that missed, so the next read is quick.
32
+ - **Write-through** — `set`, `delete`, and `clear` apply to every tier.
33
+ - **Expiry** — expired entries are skipped while walking tiers.
34
+ - **`stats()`** — `entryCount` is the max across tiers (writes are mirrored), `sizeBytes` and `evictions` are summed across tiers that report them.
35
+
36
+ Tiers are just `StorageAdapter`s, so any combination works (memory + Redis, Redis + Postgres, three tiers, etc.). It is a `StorageAdapter` itself, so it drops into any cache manager.
37
+
38
+ ## License
39
+
40
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ TieredAdapter: () => TieredAdapter
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+
27
+ // src/TieredAdapter.ts
28
+ var import_core = require("@nodellmcache/core");
29
+ var TieredAdapter = class {
30
+ tiers;
31
+ constructor(options) {
32
+ if (!options.tiers || options.tiers.length === 0) {
33
+ throw new import_core.ValidationError("TieredAdapter requires at least one tier");
34
+ }
35
+ this.tiers = options.tiers;
36
+ }
37
+ async get(key) {
38
+ for (let i = 0; i < this.tiers.length; i++) {
39
+ const entry = await this.tiers[i].get(key);
40
+ if (entry && !import_core.TTLManager.isExpired(entry)) {
41
+ for (let j = 0; j < i; j++) {
42
+ await this.tiers[j].set(key, entry);
43
+ }
44
+ return entry;
45
+ }
46
+ }
47
+ return null;
48
+ }
49
+ async set(key, entry, ttl) {
50
+ await Promise.all(this.tiers.map((tier) => tier.set(key, entry, ttl)));
51
+ }
52
+ async delete(key) {
53
+ await Promise.all(this.tiers.map((tier) => tier.delete(key)));
54
+ }
55
+ async clear() {
56
+ await Promise.all(this.tiers.map((tier) => tier.clear()));
57
+ }
58
+ async has(key) {
59
+ for (const tier of this.tiers) {
60
+ if (await tier.has(key)) return true;
61
+ }
62
+ return false;
63
+ }
64
+ /**
65
+ * Aggregate stats across tiers. `entryCount` is the max across tiers (the most
66
+ * complete tier, since writes are mirrored); `sizeBytes` and `evictions` are
67
+ * summed across the tiers that report them.
68
+ */
69
+ async stats() {
70
+ const all = await Promise.all(this.tiers.map((tier) => tier.stats()));
71
+ let entryCount = 0;
72
+ let sizeBytes;
73
+ let evictions;
74
+ for (const s of all) {
75
+ entryCount = Math.max(entryCount, s.entryCount);
76
+ if (s.sizeBytes !== void 0) sizeBytes = (sizeBytes ?? 0) + s.sizeBytes;
77
+ if (s.evictions !== void 0) evictions = (evictions ?? 0) + s.evictions;
78
+ }
79
+ return { entryCount, sizeBytes, evictions };
80
+ }
81
+ };
82
+ // Annotate the CommonJS export names for ESM import in node:
83
+ 0 && (module.exports = {
84
+ TieredAdapter
85
+ });
86
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/TieredAdapter.ts"],"sourcesContent":["export { TieredAdapter, type TieredAdapterOptions } from './TieredAdapter.js'\n","import { TTLManager, ValidationError } from '@nodellmcache/core'\nimport type { AdapterStats, CacheEntry, StorageAdapter } from '@nodellmcache/core'\n\nexport interface TieredAdapterOptions<T> {\n /**\n * Storage tiers ordered fastest to slowest, e.g. `[memory, redis]`. Reads walk\n * the tiers in order; writes go to all of them.\n */\n tiers: StorageAdapter<T>[]\n}\n\n/**\n * Composes several {@link StorageAdapter}s into one multi-tier cache.\n *\n * - **Read-through with promotion**: `get` checks tiers fastest-first and, on a\n * hit in a slower tier, back-fills the faster tiers so the next read is quick.\n * - **Write-through**: `set`, `delete`, and `clear` apply to every tier.\n *\n * A typical setup is L1 in-process memory plus L2 Redis: microsecond hits when\n * hot, a shared durable tier when not.\n */\nexport class TieredAdapter<T = unknown> implements StorageAdapter<T> {\n private readonly tiers: StorageAdapter<T>[]\n\n constructor(options: TieredAdapterOptions<T>) {\n if (!options.tiers || options.tiers.length === 0) {\n throw new ValidationError('TieredAdapter requires at least one tier')\n }\n this.tiers = options.tiers\n }\n\n async get(key: string): Promise<CacheEntry<T> | null> {\n for (let i = 0; i < this.tiers.length; i++) {\n const entry = await this.tiers[i]!.get(key)\n if (entry && !TTLManager.isExpired(entry)) {\n // Promote into the faster tiers that missed.\n for (let j = 0; j < i; j++) {\n await this.tiers[j]!.set(key, entry)\n }\n return entry\n }\n }\n return null\n }\n\n async set(key: string, entry: CacheEntry<T>, ttl?: number): Promise<void> {\n await Promise.all(this.tiers.map((tier) => tier.set(key, entry, ttl)))\n }\n\n async delete(key: string): Promise<void> {\n await Promise.all(this.tiers.map((tier) => tier.delete(key)))\n }\n\n async clear(): Promise<void> {\n await Promise.all(this.tiers.map((tier) => tier.clear()))\n }\n\n async has(key: string): Promise<boolean> {\n for (const tier of this.tiers) {\n if (await tier.has(key)) return true\n }\n return false\n }\n\n /**\n * Aggregate stats across tiers. `entryCount` is the max across tiers (the most\n * complete tier, since writes are mirrored); `sizeBytes` and `evictions` are\n * summed across the tiers that report them.\n */\n async stats(): Promise<AdapterStats> {\n const all = await Promise.all(this.tiers.map((tier) => tier.stats()))\n let entryCount = 0\n let sizeBytes: number | undefined\n let evictions: number | undefined\n for (const s of all) {\n entryCount = Math.max(entryCount, s.entryCount)\n if (s.sizeBytes !== undefined) sizeBytes = (sizeBytes ?? 0) + s.sizeBytes\n if (s.evictions !== undefined) evictions = (evictions ?? 0) + s.evictions\n }\n return { entryCount, sizeBytes, evictions }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAA4C;AAqBrC,IAAM,gBAAN,MAA8D;AAAA,EAClD;AAAA,EAEjB,YAAY,SAAkC;AAC5C,QAAI,CAAC,QAAQ,SAAS,QAAQ,MAAM,WAAW,GAAG;AAChD,YAAM,IAAI,4BAAgB,0CAA0C;AAAA,IACtE;AACA,SAAK,QAAQ,QAAQ;AAAA,EACvB;AAAA,EAEA,MAAM,IAAI,KAA4C;AACpD,aAAS,IAAI,GAAG,IAAI,KAAK,MAAM,QAAQ,KAAK;AAC1C,YAAM,QAAQ,MAAM,KAAK,MAAM,CAAC,EAAG,IA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@
1
+ import { StorageAdapter, CacheEntry, AdapterStats } from '@nodellmcache/core';
2
+
3
+ interface TieredAdapterOptions<T> {
4
+ /**
5
+ * Storage tiers ordered fastest to slowest, e.g. `[memory, redis]`. Reads walk
6
+ * the tiers in order; writes go to all of them.
7
+ */
8
+ tiers: StorageAdapter<T>[];
9
+ }
10
+ /**
11
+ * Composes several {@link StorageAdapter}s into one multi-tier cache.
12
+ *
13
+ * - **Read-through with promotion**: `get` checks tiers fastest-first and, on a
14
+ * hit in a slower tier, back-fills the faster tiers so the next read is quick.
15
+ * - **Write-through**: `set`, `delete`, and `clear` apply to every tier.
16
+ *
17
+ * A typical setup is L1 in-process memory plus L2 Redis: microsecond hits when
18
+ * hot, a shared durable tier when not.
19
+ */
20
+ declare class TieredAdapter<T = unknown> implements StorageAdapter<T> {
21
+ private readonly tiers;
22
+ constructor(options: TieredAdapterOptions<T>);
23
+ get(key: string): Promise<CacheEntry<T> | null>;
24
+ set(key: string, entry: CacheEntry<T>, ttl?: number): Promise<void>;
25
+ delete(key: string): Promise<void>;
26
+ clear(): Promise<void>;
27
+ has(key: string): Promise<boolean>;
28
+ /**
29
+ * Aggregate stats across tiers. `entryCount` is the max across tiers (the most
30
+ * complete tier, since writes are mirrored); `sizeBytes` and `evictions` are
31
+ * summed across the tiers that report them.
32
+ */
33
+ stats(): Promise<AdapterStats>;
34
+ }
35
+
36
+ export { TieredAdapter, type TieredAdapterOptions };
@@ -0,0 +1,36 @@
1
+ import { StorageAdapter, CacheEntry, AdapterStats } from '@nodellmcache/core';
2
+
3
+ interface TieredAdapterOptions<T> {
4
+ /**
5
+ * Storage tiers ordered fastest to slowest, e.g. `[memory, redis]`. Reads walk
6
+ * the tiers in order; writes go to all of them.
7
+ */
8
+ tiers: StorageAdapter<T>[];
9
+ }
10
+ /**
11
+ * Composes several {@link StorageAdapter}s into one multi-tier cache.
12
+ *
13
+ * - **Read-through with promotion**: `get` checks tiers fastest-first and, on a
14
+ * hit in a slower tier, back-fills the faster tiers so the next read is quick.
15
+ * - **Write-through**: `set`, `delete`, and `clear` apply to every tier.
16
+ *
17
+ * A typical setup is L1 in-process memory plus L2 Redis: microsecond hits when
18
+ * hot, a shared durable tier when not.
19
+ */
20
+ declare class TieredAdapter<T = unknown> implements StorageAdapter<T> {
21
+ private readonly tiers;
22
+ constructor(options: TieredAdapterOptions<T>);
23
+ get(key: string): Promise<CacheEntry<T> | null>;
24
+ set(key: string, entry: CacheEntry<T>, ttl?: number): Promise<void>;
25
+ delete(key: string): Promise<void>;
26
+ clear(): Promise<void>;
27
+ has(key: string): Promise<boolean>;
28
+ /**
29
+ * Aggregate stats across tiers. `entryCount` is the max across tiers (the most
30
+ * complete tier, since writes are mirrored); `sizeBytes` and `evictions` are
31
+ * summed across the tiers that report them.
32
+ */
33
+ stats(): Promise<AdapterStats>;
34
+ }
35
+
36
+ export { TieredAdapter, type TieredAdapterOptions };
package/dist/index.mjs ADDED
@@ -0,0 +1,59 @@
1
+ // src/TieredAdapter.ts
2
+ import { TTLManager, ValidationError } from "@nodellmcache/core";
3
+ var TieredAdapter = class {
4
+ tiers;
5
+ constructor(options) {
6
+ if (!options.tiers || options.tiers.length === 0) {
7
+ throw new ValidationError("TieredAdapter requires at least one tier");
8
+ }
9
+ this.tiers = options.tiers;
10
+ }
11
+ async get(key) {
12
+ for (let i = 0; i < this.tiers.length; i++) {
13
+ const entry = await this.tiers[i].get(key);
14
+ if (entry && !TTLManager.isExpired(entry)) {
15
+ for (let j = 0; j < i; j++) {
16
+ await this.tiers[j].set(key, entry);
17
+ }
18
+ return entry;
19
+ }
20
+ }
21
+ return null;
22
+ }
23
+ async set(key, entry, ttl) {
24
+ await Promise.all(this.tiers.map((tier) => tier.set(key, entry, ttl)));
25
+ }
26
+ async delete(key) {
27
+ await Promise.all(this.tiers.map((tier) => tier.delete(key)));
28
+ }
29
+ async clear() {
30
+ await Promise.all(this.tiers.map((tier) => tier.clear()));
31
+ }
32
+ async has(key) {
33
+ for (const tier of this.tiers) {
34
+ if (await tier.has(key)) return true;
35
+ }
36
+ return false;
37
+ }
38
+ /**
39
+ * Aggregate stats across tiers. `entryCount` is the max across tiers (the most
40
+ * complete tier, since writes are mirrored); `sizeBytes` and `evictions` are
41
+ * summed across the tiers that report them.
42
+ */
43
+ async stats() {
44
+ const all = await Promise.all(this.tiers.map((tier) => tier.stats()));
45
+ let entryCount = 0;
46
+ let sizeBytes;
47
+ let evictions;
48
+ for (const s of all) {
49
+ entryCount = Math.max(entryCount, s.entryCount);
50
+ if (s.sizeBytes !== void 0) sizeBytes = (sizeBytes ?? 0) + s.sizeBytes;
51
+ if (s.evictions !== void 0) evictions = (evictions ?? 0) + s.evictions;
52
+ }
53
+ return { entryCount, sizeBytes, evictions };
54
+ }
55
+ };
56
+ export {
57
+ TieredAdapter
58
+ };
59
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/TieredAdapter.ts"],"sourcesContent":["import { TTLManager, ValidationError } from '@nodellmcache/core'\nimport type { AdapterStats, CacheEntry, StorageAdapter } from '@nodellmcache/core'\n\nexport interface TieredAdapterOptions<T> {\n /**\n * Storage tiers ordered fastest to slowest, e.g. `[memory, redis]`. Reads walk\n * the tiers in order; writes go to all of them.\n */\n tiers: StorageAdapter<T>[]\n}\n\n/**\n * Composes several {@link StorageAdapter}s into one multi-tier cache.\n *\n * - **Read-through with promotion**: `get` checks tiers fastest-first and, on a\n * hit in a slower tier, back-fills the faster tiers so the next read is quick.\n * - **Write-through**: `set`, `delete`, and `clear` apply to every tier.\n *\n * A typical setup is L1 in-process memory plus L2 Redis: microsecond hits when\n * hot, a shared durable tier when not.\n */\nexport class TieredAdapter<T = unknown> implements StorageAdapter<T> {\n private readonly tiers: StorageAdapter<T>[]\n\n constructor(options: TieredAdapterOptions<T>) {\n if (!options.tiers || options.tiers.length === 0) {\n throw new ValidationError('TieredAdapter requires at least one tier')\n }\n this.tiers = options.tiers\n }\n\n async get(key: string): Promise<CacheEntry<T> | null> {\n for (let i = 0; i < this.tiers.length; i++) {\n const entry = await this.tiers[i]!.get(key)\n if (entry && !TTLManager.isExpired(entry)) {\n // Promote into the faster tiers that missed.\n for (let j = 0; j < i; j++) {\n await this.tiers[j]!.set(key, entry)\n }\n return entry\n }\n }\n return null\n }\n\n async set(key: string, entry: CacheEntry<T>, ttl?: number): Promise<void> {\n await Promise.all(this.tiers.map((tier) => tier.set(key, entry, ttl)))\n }\n\n async delete(key: string): Promise<void> {\n await Promise.all(this.tiers.map((tier) => tier.delete(key)))\n }\n\n async clear(): Promise<void> {\n await Promise.all(this.tiers.map((tier) => tier.clear()))\n }\n\n async has(key: string): Promise<boolean> {\n for (const tier of this.tiers) {\n if (await tier.has(key)) return true\n }\n return false\n }\n\n /**\n * Aggregate stats across tiers. `entryCount` is the max across tiers (the most\n * complete tier, since writes are mirrored); `sizeBytes` and `evictions` are\n * summed across the tiers that report them.\n */\n async stats(): Promise<AdapterStats> {\n const all = await Promise.all(this.tiers.map((tier) => tier.stats()))\n let entryCount = 0\n let sizeBytes: number | undefined\n let evictions: number | undefined\n for (const s of all) {\n entryCount = Math.max(entryCount, s.entryCount)\n if (s.sizeBytes !== undefined) sizeBytes = (sizeBytes ?? 0) + s.sizeBytes\n if (s.evictions !== undefined) evictions = (evictions ?? 0) + s.evictions\n }\n return { entryCount, sizeBytes, evictions }\n }\n}\n"],"mappings":";AAAA,SAAS,YAAY,uBAAuB;AAqBrC,IAAM,gBAAN,MAA8D;AAAA,EAClD;AAAA,EAEjB,YAAY,SAAkC;AAC5C,QAAI,CAAC,QAAQ,SAAS,QAAQ,MAAM,WAAW,GAAG;AAChD,YAAM,IAAI,gBAAgB,0CAA0C;AAAA,IACtE;AACA,SAAK,QAAQ,QAAQ;AAAA,EACvB;AAAA,EAEA,MAAM,IAAI,KAA4C;AACpD,aAAS,IAAI,GAAG,IAAI,KAAK,MAAM,QAAQ,KAAK;AAC1C,YAAM,QAAQ,MAAM,KAAK,MAAM,CAAC,EAAG,IA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,0 +1,61 @@
1
+ {
2
+ "name": "@nodellmcache/tiered",
3
+ "version": "1.0.0",
4
+ "description": "Multi-tier (L1/L2) storage adapter for NodeLLMCache with read-through and write-through",
5
+ "keywords": [
6
+ "llm",
7
+ "cache",
8
+ "tiered",
9
+ "multi-tier",
10
+ "l1",
11
+ "l2",
12
+ "nodejs"
13
+ ],
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/mdmax007/node-llm-cache.git",
18
+ "directory": "packages/tiered"
19
+ },
20
+ "homepage": "https://github.com/mdmax007/node-llm-cache/tree/main/packages/tiered#readme",
21
+ "bugs": "https://github.com/mdmax007/node-llm-cache/issues",
22
+ "type": "module",
23
+ "main": "./dist/index.cjs",
24
+ "module": "./dist/index.mjs",
25
+ "types": "./dist/index.d.ts",
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "import": "./dist/index.mjs",
30
+ "require": "./dist/index.cjs"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "README.md",
36
+ "CHANGELOG.md"
37
+ ],
38
+ "peerDependencies": {
39
+ "@nodellmcache/core": "^1.0.0"
40
+ },
41
+ "devDependencies": {
42
+ "@types/node": "^20.0.0",
43
+ "tsup": "^8.0.0",
44
+ "typescript": "^5.5.0",
45
+ "vitest": "^2.0.0",
46
+ "@vitest/coverage-v8": "^2.0.0",
47
+ "@nodellmcache/core": "1.0.0",
48
+ "@nodellmcache/memory": "1.0.0"
49
+ },
50
+ "publishConfig": {
51
+ "access": "public"
52
+ },
53
+ "scripts": {
54
+ "build": "tsup",
55
+ "test": "vitest run",
56
+ "test:watch": "vitest",
57
+ "test:coverage": "vitest run --coverage",
58
+ "typecheck": "tsc --noEmit",
59
+ "lint": "echo \"no lint configured\""
60
+ }
61
+ }