tricache 0.9.0 → 1.0.1

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.
Files changed (53) hide show
  1. package/README.md +7 -3
  2. package/dist/{cache-service-DVvroyqA.d.ts → cache-service-CREOp7MM.d.ts} +57 -12
  3. package/dist/{cache-service-KI5ACF3F.js → cache-service-MG7PN6MX.js} +3 -3
  4. package/dist/{chunk-XZL45ABR.js → chunk-2AJKEQMZ.js} +54 -1
  5. package/dist/{chunk-QNU7B43J.js → chunk-3I5L7K6I.js} +17 -0
  6. package/dist/{chunk-PL5J3ZNT.js → chunk-JYQFQJNJ.js} +682 -277
  7. package/dist/{chunk-LJ5QJB5O.js → chunk-UBWLPKTI.js} +127 -11
  8. package/dist/cli.cjs +857 -293
  9. package/dist/cli.js +4 -4
  10. package/dist/dashboard/index.d.ts +2 -2
  11. package/dist/drizzle/index.cjs +865 -294
  12. package/dist/drizzle/index.d.ts +2 -2
  13. package/dist/drizzle/index.js +1 -1
  14. package/dist/edge/index.cjs +115 -36
  15. package/dist/edge/index.d.ts +3 -3
  16. package/dist/edge/index.js +88 -37
  17. package/dist/hono/index.cjs +865 -294
  18. package/dist/hono/index.d.ts +2 -2
  19. package/dist/hono/index.js +1 -1
  20. package/dist/{hono-VA9A1m0I.d.ts → hono-DSV2ve66.d.ts} +11 -4
  21. package/dist/http/index.cjs +917 -315
  22. package/dist/http/index.d.ts +3 -3
  23. package/dist/http/index.js +60 -29
  24. package/dist/index.cjs +885 -294
  25. package/dist/index.d.ts +37 -7
  26. package/dist/index.js +16 -6
  27. package/dist/nestjs/index.cjs +856 -292
  28. package/dist/nestjs/index.d.ts +2 -2
  29. package/dist/nestjs/index.js +4 -4
  30. package/dist/next/index.cjs +858 -300
  31. package/dist/next/index.d.ts +2 -2
  32. package/dist/next/index.js +5 -11
  33. package/dist/prisma/index.d.ts +2 -2
  34. package/dist/serialize-worker.cjs +127 -9
  35. package/dist/serialize-worker.js +8 -4
  36. package/dist/{types-B_QkVwJ7.d.ts → types-Dyip5wAl.d.ts} +53 -7
  37. package/package.json +7 -4
  38. package/src/adapters/node-redis.ts +19 -0
  39. package/src/cache-service.ts +781 -297
  40. package/src/cli.ts +1 -1
  41. package/src/compression.ts +193 -15
  42. package/src/cross-region.ts +1 -1
  43. package/src/edge/cache.ts +94 -42
  44. package/src/env.d.ts +13 -0
  45. package/src/http/express.ts +55 -16
  46. package/src/http/fastify.ts +3 -7
  47. package/src/index.ts +9 -1
  48. package/src/next/cache-handler.ts +1 -4
  49. package/src/next/isr-handler.ts +1 -4
  50. package/src/serialize-worker.ts +6 -2
  51. package/src/smart-memory-cache.ts +3 -2
  52. package/src/types.ts +45 -5
  53. package/src/utils/tag-matcher.ts +90 -0
@@ -1,5 +1,5 @@
1
- import { C as CacheService } from '../cache-service-DVvroyqA.js';
2
- import { W as WrapOptions } from '../types-B_QkVwJ7.js';
1
+ import { C as CacheService } from '../cache-service-CREOp7MM.js';
2
+ import { W as WrapOptions } from '../types-Dyip5wAl.js';
3
3
  import { K as KeyDerivationOptions } from '../utils-CEsU_Z0s.js';
4
4
  import 'crypto';
5
5
 
@@ -143,7 +143,7 @@ function cacheMiddleware(options = {}) {
143
143
  return await next();
144
144
  }
145
145
  if (!resolvedCache) {
146
- const { CacheService } = await import("../cache-service-KI5ACF3F.js");
146
+ const { CacheService } = await import("../cache-service-MG7PN6MX.js");
147
147
  resolvedCache = CacheService.create();
148
148
  }
149
149
  const activeCache = resolvedCache;
@@ -1,4 +1,4 @@
1
- import { I as ICacheTracer } from './types-B_QkVwJ7.js';
1
+ import { I as ICacheTracer, a as InvalidateTagOptions } from './types-Dyip5wAl.js';
2
2
 
3
3
  /**
4
4
  * Pluggable asynchronous key-value storage adapter for Edge runtimes (L2 tier).
@@ -238,6 +238,7 @@ declare class EdgeCacheService {
238
238
  private currentBytes;
239
239
  private readonly inflight;
240
240
  private readonly tagIndex;
241
+ private static readonly MAX_TAG_VERSION_CACHE;
241
242
  private readonly tagVersionCache;
242
243
  private readonly tagVersionTtlMs;
243
244
  constructor(options?: EdgeCacheOptions);
@@ -250,6 +251,7 @@ declare class EdgeCacheService {
250
251
  private _evictIfNeeded;
251
252
  private _deleteL1;
252
253
  private _startSpan;
254
+ private _setTagVersionCache;
253
255
  private _getTagVersion;
254
256
  private _batchGetTagVersions;
255
257
  /**
@@ -263,15 +265,20 @@ declare class EdgeCacheService {
263
265
  set<T>(key: string, value: T, ttlSeconds?: number, options?: {
264
266
  tags?: string[];
265
267
  swr?: number;
266
- }): Promise<void>;
268
+ } | string[]): Promise<void>;
267
269
  /**
268
270
  * Deletes a key from all tiers.
269
271
  */
270
272
  delete(key: string): Promise<void>;
273
+ /**
274
+ * Executes invalidation for a single already-resolved concrete tag without
275
+ * re-entering wildcard/cascade resolution.
276
+ */
277
+ private _invalidateConcreteTag;
271
278
  /**
272
279
  * Invalidates all cached entries associated with a tag.
273
280
  */
274
- invalidateTag(tag: string): Promise<void>;
281
+ invalidateTag(tag: string, opts?: InvalidateTagOptions): Promise<void>;
275
282
  /**
276
283
  * Clears all entries from the edge cache.
277
284
  */
@@ -279,7 +286,7 @@ declare class EdgeCacheService {
279
286
  /**
280
287
  * Batch get with miss-fetching.
281
288
  */
282
- mget<T>(keys: string[], fetchFn?: (missKeys: string[]) => Promise<Record<string, T>>, ttlSeconds?: number): Promise<(T | null)[]>;
289
+ mget<T>(keys: string[], fetchFn?: (missKeys: string[]) => Promise<Record<string, T> | Map<string, T>>, ttlSeconds?: number): Promise<(T | null)[]>;
283
290
  /**
284
291
  * Serializes active, unexpired L1 entries into a snapshot string (encrypted if WebCrypto encryption is enabled).
285
292
  * Ideal for persisting Edge state to Cloudflare R2 before worker restart.