tricache 0.7.1 → 0.9.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/LICENSE +21 -21
- package/README.md +89 -1371
- package/dashboards/prometheus-scrape.yml +18 -0
- package/dashboards/tricache-alerts.yaml +54 -0
- package/dashboards/tricache-grafana.json +548 -0
- package/dist/cache-service-DVvroyqA.d.ts +886 -0
- package/dist/cache-service-KI5ACF3F.js +12 -0
- package/dist/chunk-7RV5ZVBB.js +1023 -0
- package/dist/chunk-BQRURGGD.js +60 -0
- package/dist/chunk-IITRFWHY.js +196 -0
- package/dist/{chunk-X5AXHPVD.js → chunk-LJ5QJB5O.js} +90 -5
- package/dist/{chunk-EUGYR7KR.js → chunk-PL5J3ZNT.js} +3184 -514
- package/dist/chunk-QNU7B43J.js +687 -0
- package/dist/chunk-UGD4VEPD.js +138 -0
- package/dist/chunk-XZL45ABR.js +108 -0
- package/dist/cli.cjs +3122 -495
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +121 -5
- package/dist/dashboard/index.cjs +1065 -0
- package/dist/dashboard/index.d.ts +183 -0
- package/dist/dashboard/index.js +22 -0
- package/dist/drizzle/index.cjs +2846 -494
- package/dist/drizzle/index.d.ts +3 -1
- package/dist/drizzle/index.js +1 -1
- package/dist/edge/index.cjs +1559 -0
- package/dist/edge/index.d.ts +127 -0
- package/dist/edge/index.js +1109 -0
- package/dist/hono/index.cjs +7760 -0
- package/dist/hono/index.d.ts +91 -0
- package/dist/hono/index.js +185 -0
- package/dist/hono-VA9A1m0I.d.ts +371 -0
- package/dist/http/index.cjs +3281 -587
- package/dist/http/index.d.ts +85 -23
- package/dist/http/index.js +176 -78
- package/dist/index.cjs +7212 -2505
- package/dist/index.d.ts +547 -30
- package/dist/index.js +104 -5
- package/dist/murmur3-CMGw9PbV.d.ts +98 -0
- package/dist/nestjs/index.cjs +2787 -487
- package/dist/nestjs/index.d.ts +3 -1
- package/dist/nestjs/index.js +6 -3
- package/dist/next/index.cjs +2804 -501
- package/dist/next/index.d.ts +4 -2
- package/dist/next/index.js +14 -10
- package/dist/prisma/index.d.ts +3 -1
- package/dist/serialize-worker.cjs +5 -4
- package/dist/serialize-worker.js +1 -1
- package/dist/{cache-service-D8tIXmzb.d.ts → types-B_QkVwJ7.d.ts} +622 -662
- package/dist/utils-CEsU_Z0s.d.ts +27 -0
- package/package.json +48 -10
- package/src/adapters/auto-pipeliner.ts +206 -0
- package/src/adapters/node-redis.ts +370 -0
- package/src/cache-service.ts +1619 -415
- package/src/cli.ts +137 -2
- package/src/codec.ts +72 -0
- package/src/cross-region.ts +245 -0
- package/src/dashboard/handler.ts +392 -0
- package/src/dashboard/html.ts +594 -0
- package/src/dashboard/index.ts +195 -0
- package/src/dashboard/types.ts +96 -0
- package/src/disk-tier.ts +449 -47
- package/src/drizzle/index.ts +86 -86
- package/src/edge/adapters/cloudflare-do.ts +130 -0
- package/src/edge/adapters/cloudflare-kv.ts +115 -0
- package/src/edge/adapters/upstash.ts +143 -0
- package/src/edge/cache.ts +797 -0
- package/src/edge/crypto.ts +182 -0
- package/src/edge/hono.ts +284 -0
- package/src/edge/index.ts +37 -0
- package/src/edge/types.ts +230 -0
- package/src/edge/utils/base64.ts +63 -0
- package/src/edge/utils/murmur3.ts +179 -0
- package/src/encryption.ts +127 -5
- package/src/hono/index.ts +316 -0
- package/src/http/express.ts +195 -0
- package/src/http/fastify.ts +260 -0
- package/src/http/index.ts +44 -258
- package/src/http/utils.ts +92 -0
- package/src/index.ts +149 -47
- package/src/ipc-telemetry.ts +509 -0
- package/src/latency-watchdog.ts +282 -0
- package/src/nestjs/decorators.ts +161 -161
- package/src/nestjs/index.ts +23 -23
- package/src/nestjs/tricache.module.ts +104 -104
- package/src/nestjs/tricache.store.ts +97 -97
- package/src/nestjs/types.ts +79 -79
- package/src/next/cache-handler.ts +12 -9
- package/src/next/index.ts +37 -37
- package/src/next/isr-handler.ts +105 -105
- package/src/next/types.ts +130 -130
- package/src/remote-snapshot.ts +153 -0
- package/src/serialize-worker.ts +120 -120
- package/src/sigv4-snapshot-adapter.ts +260 -0
- package/src/smart-memory-cache.ts +91 -8
- package/src/types.ts +315 -2
- package/src/utils/cgroup.ts +100 -0
- package/src/utils/tracing.ts +54 -0
- package/src/wasm/bloom-filter-wasm.ts +109 -102
- package/src/worker-pool.ts +299 -299
- package/src/wtiny-lfu.ts +624 -0
- package/dist/cache-service-5GATUYAK.js +0 -7
- package/dist/chunk-UBSR5UYA.js +0 -0
package/dist/next/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as CacheService } from '../cache-service-DVvroyqA.js';
|
|
2
|
+
import { C as CacheOptions, h as ILogger } from '../types-B_QkVwJ7.js';
|
|
3
|
+
import 'crypto';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* Next.js 16 modern CacheHandler value shape for `"use cache"` components.
|
|
@@ -138,7 +140,7 @@ declare class TriCacheHandler {
|
|
|
138
140
|
* Get an entry from cache. Checks softTags against generational tag versions
|
|
139
141
|
* and returns a fresh unlocked ReadableStream if the stored value was a stream.
|
|
140
142
|
*/
|
|
141
|
-
get(cacheKey: string, ctx?: CacheHandlerContext): Promise<CacheHandlerValue |
|
|
143
|
+
get(cacheKey: string, ctx?: CacheHandlerContext): Promise<CacheHandlerValue | undefined>;
|
|
142
144
|
/**
|
|
143
145
|
* Write an entry into cache. Drains incoming ReadableStream into a contiguous buffer
|
|
144
146
|
* before storing. Catches mid-flight stream aborts to avoid crashing Next.js.
|
package/dist/next/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CacheService
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-PL5J3ZNT.js";
|
|
4
4
|
import {
|
|
5
5
|
consoleLogger
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-LJ5QJB5O.js";
|
|
7
|
+
import "../chunk-XZL45ABR.js";
|
|
7
8
|
|
|
8
9
|
// src/next/cache-handler.ts
|
|
9
10
|
var PRESET_CACHE_LIFE_PROFILES = {
|
|
@@ -80,14 +81,15 @@ var TriCacheHandler = class {
|
|
|
80
81
|
async () => null
|
|
81
82
|
);
|
|
82
83
|
if (!stored || stored.data == null) {
|
|
83
|
-
return
|
|
84
|
+
return void 0;
|
|
84
85
|
}
|
|
85
86
|
if (ctx?.softTags && ctx.softTags.length > 0) {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
const softTags = ctx.softTags;
|
|
88
|
+
const currentVers = await Promise.all(softTags.map((st) => this.cache.getTagVersion(st)));
|
|
89
|
+
for (let i = 0; i < softTags.length; i++) {
|
|
90
|
+
const storedSoftVer = stored.softTagVersions?.[softTags[i]] ?? 0;
|
|
91
|
+
if (currentVers[i] > storedSoftVer) {
|
|
92
|
+
return void 0;
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
95
|
}
|
|
@@ -141,9 +143,11 @@ var TriCacheHandler = class {
|
|
|
141
143
|
const tags = Array.from(/* @__PURE__ */ new Set([...entry.tags ?? [], ...ctx?.tags ?? []]));
|
|
142
144
|
let softTagVersions;
|
|
143
145
|
if (ctx?.softTags && ctx.softTags.length > 0) {
|
|
146
|
+
const softTags = ctx.softTags;
|
|
147
|
+
const vers = await Promise.all(softTags.map((st) => this.cache.getTagVersion(st)));
|
|
144
148
|
softTagVersions = {};
|
|
145
|
-
for (
|
|
146
|
-
softTagVersions[
|
|
149
|
+
for (let i = 0; i < softTags.length; i++) {
|
|
150
|
+
softTagVersions[softTags[i]] = vers[i];
|
|
147
151
|
}
|
|
148
152
|
}
|
|
149
153
|
const stored = {
|
package/dist/prisma/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as CacheService } from '../cache-service-DVvroyqA.js';
|
|
2
|
+
import { W as WrapOptions } from '../types-B_QkVwJ7.js';
|
|
3
|
+
import 'crypto';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* tricache/prisma — First-class Prisma Client extension for TriCache.
|
|
@@ -154,17 +154,17 @@ var CacheEncryption = class {
|
|
|
154
154
|
throw new Error("XOR key must be at least 1 byte");
|
|
155
155
|
}
|
|
156
156
|
this._key = buf;
|
|
157
|
-
if (
|
|
157
|
+
if (resolvedMode !== "xor") {
|
|
158
158
|
this._keyObj = (0, import_crypto.createSecretKey)(buf);
|
|
159
159
|
const _wc = (0, import_crypto.createCipheriv)(
|
|
160
|
-
|
|
160
|
+
resolvedMode,
|
|
161
161
|
this._keyObj,
|
|
162
|
-
Buffer.alloc(
|
|
162
|
+
Buffer.alloc(resolvedMode === "aes-128-ctr" ? CTR_IV_BYTES : IV_BYTES)
|
|
163
163
|
);
|
|
164
164
|
_wc.update(Buffer.alloc(0));
|
|
165
165
|
_wc.final();
|
|
166
166
|
}
|
|
167
|
-
if (
|
|
167
|
+
if (resolvedMode === "xor") {
|
|
168
168
|
logger.warn(
|
|
169
169
|
"Cache obfuscation enabled (XOR). WARNING: XOR is NOT cryptographic \u2014 use only for dev or non-sensitive data."
|
|
170
170
|
);
|
|
@@ -432,6 +432,7 @@ var CacheEncryption = class {
|
|
|
432
432
|
return plain;
|
|
433
433
|
}
|
|
434
434
|
};
|
|
435
|
+
var MAGIC_ENVELOPE = Buffer.from([84, 82, 73, 67, 69, 78, 86, 49]);
|
|
435
436
|
|
|
436
437
|
// src/compression.ts
|
|
437
438
|
var import_zlib = __toESM(require("zlib"), 1);
|