tricache 1.0.1 → 2.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/README.md +89 -93
- package/dashboards/tricache-alerts.yaml +80 -4
- package/dashboards/tricache-grafana.json +54 -1
- package/dashboards/tricache-inventory.rules.yml +21 -0
- package/dist/cache-service-BV5T8-20.d.cts +1064 -0
- package/dist/cache-service-UZXOQGEY.js +14 -0
- package/dist/{cache-service-CREOp7MM.d.ts → cache-service-tpyrXvlH.d.ts} +157 -24
- package/dist/{chunk-UBWLPKTI.js → chunk-EJXG7WO6.js} +152 -32
- package/dist/{chunk-IITRFWHY.js → chunk-EUKB7RKP.js} +21 -4
- package/dist/{chunk-7RV5ZVBB.js → chunk-JNSLMK4Q.js} +111 -29
- package/dist/{chunk-2AJKEQMZ.js → chunk-KV7KISK2.js} +54 -5
- package/dist/{chunk-JYQFQJNJ.js → chunk-MB3DMVWN.js} +3424 -1022
- package/dist/chunk-RBJRTGFK.js +94 -0
- package/dist/chunk-S5N65I45.js +17 -0
- package/dist/cli.cjs +3694 -1070
- package/dist/cli.d.cts +12 -0
- package/dist/cli.js +210 -14
- package/dist/dashboard/index.cjs +111 -29
- package/dist/dashboard/index.d.cts +185 -0
- package/dist/dashboard/index.d.ts +5 -3
- package/dist/dashboard/index.js +1 -1
- package/dist/drizzle/index.cjs +3578 -1068
- package/dist/drizzle/index.d.cts +46 -0
- package/dist/drizzle/index.d.ts +2 -2
- package/dist/drizzle/index.js +6 -2
- package/dist/edge/index.cjs +368 -162
- package/dist/edge/index.d.cts +134 -0
- package/dist/edge/index.d.ts +11 -4
- package/dist/edge/index.js +314 -155
- package/dist/hono/index.cjs +3614 -1087
- package/dist/hono/index.d.cts +93 -0
- package/dist/hono/index.d.ts +7 -5
- package/dist/hono/index.js +16 -9
- package/dist/hono-CMv2VdQ6.d.cts +404 -0
- package/dist/{hono-DSV2ve66.d.ts → hono-Dvq04kX9.d.ts} +33 -7
- package/dist/http/index.cjs +3712 -1124
- package/dist/http/index.d.cts +103 -0
- package/dist/http/index.d.ts +13 -5
- package/dist/http/index.js +92 -43
- package/dist/index.cjs +4067 -1252
- package/dist/index.d.cts +1071 -0
- package/dist/index.d.ts +123 -27
- package/dist/index.js +878 -21
- package/dist/{murmur3-CMGw9PbV.d.ts → murmur3-DF8BFRnu.d.cts} +1 -0
- package/dist/murmur3-DF8BFRnu.d.ts +99 -0
- package/dist/nestjs/index.cjs +3635 -1112
- package/dist/nestjs/index.d.cts +299 -0
- package/dist/nestjs/index.d.ts +120 -33
- package/dist/nestjs/index.js +132 -43
- package/dist/next/index.cjs +3704 -1175
- package/dist/next/index.d.cts +238 -0
- package/dist/next/index.d.ts +39 -11
- package/dist/next/index.js +202 -102
- package/dist/prisma/index.cjs +29 -18
- package/dist/prisma/index.d.cts +62 -0
- package/dist/prisma/index.d.ts +2 -2
- package/dist/prisma/index.js +17 -18
- package/dist/serialize-worker.cjs +162 -39
- package/dist/serialize-worker.d.cts +2 -0
- package/dist/serialize-worker.js +9 -7
- package/dist/{types-Dyip5wAl.d.ts → types-F8vRWMrE.d.cts} +186 -54
- package/dist/types-F8vRWMrE.d.ts +1636 -0
- package/dist/{utils-CEsU_Z0s.d.ts → utils-Bvzn-rKS.d.cts} +3 -1
- package/dist/utils-Bvzn-rKS.d.ts +29 -0
- package/package.json +116 -37
- package/src/adapters/auto-pipeliner.ts +150 -26
- package/src/adapters/node-redis.ts +106 -27
- package/src/cache-service.ts +2215 -793
- package/src/cli.ts +25 -14
- package/src/codec.ts +3 -3
- package/src/compression.ts +39 -16
- package/src/cross-region.ts +22 -4
- package/src/dashboard/handler.ts +26 -6
- package/src/dashboard/html.ts +35 -10
- package/src/dashboard/index.ts +35 -13
- package/src/dashboard/types.ts +3 -1
- package/src/disk-tier.ts +448 -102
- package/src/drizzle/index.ts +2 -1
- package/src/edge/adapters/cloudflare-do.ts +25 -10
- package/src/edge/adapters/cloudflare-kv.ts +12 -9
- package/src/edge/adapters/upstash.ts +27 -11
- package/src/edge/cache.ts +200 -110
- package/src/edge/hono.ts +23 -6
- package/src/edge/types.ts +17 -5
- package/src/encryption.ts +50 -18
- package/src/env.d.ts +1 -1
- package/src/errors.ts +12 -0
- package/src/hono/index.ts +19 -9
- package/src/http/express.ts +62 -17
- package/src/http/fastify.ts +35 -21
- package/src/http/utils.ts +60 -20
- package/src/index.ts +6 -0
- package/src/ipc-telemetry.ts +35 -9
- package/src/latency-watchdog.ts +5 -1
- package/src/nestjs/decorators.ts +11 -6
- package/src/nestjs/index.ts +2 -0
- package/src/nestjs/keyv-adapter.ts +68 -0
- package/src/nestjs/tricache.module.ts +15 -12
- package/src/nestjs/tricache.store.ts +69 -26
- package/src/nestjs/types.ts +30 -16
- package/src/next/cache-handler.ts +151 -53
- package/src/next/index.ts +1 -0
- package/src/next/types.ts +25 -0
- package/src/origin-capacity.ts +134 -0
- package/src/prisma/index.ts +17 -24
- package/src/remote-snapshot.ts +37 -27
- package/src/serialize-worker.ts +8 -5
- package/src/sigv4-snapshot-adapter.ts +37 -27
- package/src/smart-memory-cache.ts +121 -44
- package/src/types.ts +117 -37
- package/src/utils/cgroup.ts +12 -0
- package/src/utils/config-comparison.ts +29 -0
- package/src/utils/deadline.ts +14 -0
- package/src/utils/diagnostics.ts +27 -0
- package/src/utils/lz4-size.ts +74 -0
- package/src/utils/namespace-key.ts +48 -0
- package/src/utils/query-key.ts +13 -0
- package/src/utils/redis-slot.ts +13 -0
- package/src/utils/snapshot-transfer.ts +83 -0
- package/src/utils/work-limits.ts +73 -0
- package/src/utils/write-revision.ts +4 -0
- package/src/wasm/bloom-filter-wasm.ts +25 -5
- package/src/worker-pool.ts +44 -15
- package/src/wtiny-lfu.ts +82 -20
- package/dist/cache-service-MG7PN6MX.js +0 -12
- package/dist/chunk-3I5L7K6I.js +0 -704
- package/dist/chunk-BQRURGGD.js +0 -60
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as ICacheTracer, a as InvalidateTagOptions } from './types-
|
|
1
|
+
import { I as ICacheTracer, a as InvalidateTagOptions } from './types-F8vRWMrE.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Pluggable asynchronous key-value storage adapter for Edge runtimes (L2 tier).
|
|
@@ -16,11 +16,15 @@ interface IEdgeRemoteStorage {
|
|
|
16
16
|
mset?(entries: Record<string, string>, ttlSeconds?: number): Promise<void>;
|
|
17
17
|
/** Optional clear by prefix or all keys. */
|
|
18
18
|
clear?(prefix?: string): Promise<void>;
|
|
19
|
-
/**
|
|
19
|
+
/** Enumerate complete keys under a literal prefix in bounded pages. Required for remote wildcard tags. */
|
|
20
|
+
scanKeys?(prefix: string): AsyncIterable<string>;
|
|
21
|
+
/** Counter semantics; Workers KV is eventually consistent, not an atomic authority. */
|
|
22
|
+
readonly tagConsistency?: 'atomic' | 'eventual';
|
|
23
|
+
/** Optional atomic or monotonic tag increment. The service supplies the complete typed storage key; adapters must use it unchanged. */
|
|
20
24
|
incrementTagVersion?(tag: string): Promise<number>;
|
|
21
|
-
/** Optional tag version retrieval. */
|
|
25
|
+
/** Optional tag version retrieval by complete typed storage key. */
|
|
22
26
|
getTagVersion?(tag: string): Promise<number>;
|
|
23
|
-
/** Optional batch tag
|
|
27
|
+
/** Optional batch tag retrieval; result keys must match the complete supplied storage keys. */
|
|
24
28
|
batchGetTagVersions?(tags: string[]): Promise<Record<string, number>>;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
@@ -67,7 +71,7 @@ interface EdgeCacheOptions {
|
|
|
67
71
|
prevKeyBase64?: string;
|
|
68
72
|
mode?: 'aes-256-gcm' | 'aes-128-gcm';
|
|
69
73
|
};
|
|
70
|
-
/**
|
|
74
|
+
/** Namespace encoded into a v3 storage keyspace with disjoint data/tag domains. Upgrades start cold; coordinate writers. Use a separate namespace from Node, whose value format differs. */
|
|
71
75
|
namespace?: string;
|
|
72
76
|
/** OpenTelemetry-compatible tracer for distributed tracing. */
|
|
73
77
|
tracer?: ICacheTracer;
|
|
@@ -77,6 +81,8 @@ interface EdgeCacheOptions {
|
|
|
77
81
|
* - `IEdgeBloomFilter`: a custom or configured `WasmBloomFilter` or `Murmur3BloomFilter` instance.
|
|
78
82
|
*/
|
|
79
83
|
bloomFilter?: boolean | IEdgeBloomFilter;
|
|
84
|
+
/** Only enable when the filter is an externally maintained, complete remote key set. Default: false. */
|
|
85
|
+
bloomFilterAuthoritative?: boolean;
|
|
80
86
|
}
|
|
81
87
|
/**
|
|
82
88
|
* Common contract for Edge-compatible Bloom filters (WASM or pure TypeScript Murmur3).
|
|
@@ -103,6 +109,8 @@ interface UpstashRedisOptions {
|
|
|
103
109
|
token: string;
|
|
104
110
|
/** Optional custom fetch implementation (defaults to globalThis.fetch). */
|
|
105
111
|
fetch?: typeof globalThis.fetch;
|
|
112
|
+
/** Allow an explicit unscoped clear() to execute FLUSHDB. Default: false. */
|
|
113
|
+
dangerouslyFlushDatabase?: boolean;
|
|
106
114
|
}
|
|
107
115
|
/**
|
|
108
116
|
* Minimal interface representing Cloudflare Workers KVNamespace binding.
|
|
@@ -144,6 +152,7 @@ interface CloudflareDOStorage {
|
|
|
144
152
|
list?<T = unknown>(options?: {
|
|
145
153
|
prefix?: string;
|
|
146
154
|
limit?: number;
|
|
155
|
+
startAfter?: string;
|
|
147
156
|
}): Promise<Map<string, T>>;
|
|
148
157
|
}
|
|
149
158
|
/**
|
|
@@ -202,6 +211,8 @@ interface EdgeExportSnapshotOptions {
|
|
|
202
211
|
*/
|
|
203
212
|
interface EdgeSnapshotPayload {
|
|
204
213
|
version: number;
|
|
214
|
+
/** Encoded storage namespace identity, not the raw namespace option. */
|
|
215
|
+
namespace: string;
|
|
205
216
|
writtenAt: number;
|
|
206
217
|
entries: Array<{
|
|
207
218
|
key: string;
|
|
@@ -230,10 +241,17 @@ declare class EdgeCacheService {
|
|
|
230
241
|
private readonly maxBytes;
|
|
231
242
|
private readonly defaultTtl;
|
|
232
243
|
private readonly namespace;
|
|
244
|
+
private readonly namespacePrefix;
|
|
245
|
+
private readonly dataPrefix;
|
|
246
|
+
private readonly tagVersionPrefix;
|
|
233
247
|
private readonly remoteStorage;
|
|
234
248
|
private readonly enc;
|
|
235
249
|
private readonly tracer;
|
|
236
250
|
private readonly bloomFilter;
|
|
251
|
+
private readonly bloomAuthoritative;
|
|
252
|
+
private globalEpoch;
|
|
253
|
+
private lastGlobalMutationAt;
|
|
254
|
+
private readonly keyEpochs;
|
|
237
255
|
private readonly l1;
|
|
238
256
|
private currentBytes;
|
|
239
257
|
private readonly inflight;
|
|
@@ -247,7 +265,13 @@ declare class EdgeCacheService {
|
|
|
247
265
|
*/
|
|
248
266
|
get bloom(): IEdgeBloomFilter | null;
|
|
249
267
|
private nk;
|
|
268
|
+
private tagVersionKey;
|
|
250
269
|
private _estimateBytes;
|
|
270
|
+
private fence;
|
|
271
|
+
private mutate;
|
|
272
|
+
private invalidateWork;
|
|
273
|
+
private storeL1;
|
|
274
|
+
private commit;
|
|
251
275
|
private _evictIfNeeded;
|
|
252
276
|
private _deleteL1;
|
|
253
277
|
private _startSpan;
|
|
@@ -332,12 +356,14 @@ interface HonoEdgeCacheOptions {
|
|
|
332
356
|
etag?: boolean;
|
|
333
357
|
/** TTL in seconds. Default: 300. */
|
|
334
358
|
ttl?: number;
|
|
335
|
-
/** Stale-While-Revalidate window in seconds. Default: undefined. */
|
|
336
|
-
swr?: number;
|
|
337
359
|
/** Cache tags for invalidation. */
|
|
338
360
|
tags?: string[] | ((c: any) => string[]);
|
|
339
361
|
/** Predicate to skip caching dynamically. */
|
|
340
362
|
skipCache?: (c: any) => boolean;
|
|
363
|
+
/** Authenticated responses require explicit opt-in and an identity-aware key. */
|
|
364
|
+
cacheAuthenticated?: boolean;
|
|
365
|
+
/** @deprecated Response refreshes run on live requests. Use EdgeCacheService.get() for data-level SWR. */
|
|
366
|
+
swr?: number;
|
|
341
367
|
}
|
|
342
368
|
interface CachedEdgeHttpResponse {
|
|
343
369
|
body: string;
|