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
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { C as CacheService, I as IIpcCacheProvider, a as IpcMetricsPayload, b as IpcTelemetryClient, c as IpcTelemetryServer, L as LatencyWatchdogOptions, d as LatencyWatchdogTelemetry, P as ProcessTerminationBus, T as TierLatencyWatchdog, e as deepMergeOptions, f as findActiveSockets, g as formatBytes, h as formatDuration, i as formatNumber, r as renderProgressBar, j as renderTopDashboard, k as resolveIpcSocketPath } from './cache-service-DVvroyqA.js';
2
- import { i as IRemoteSnapshotAdapter, j as CategoryLimit, S as SmartCacheEntry, k as EvictionReason, h as ILogger, l as CacheHit, e as CachePriority, g as WTinyLfuStats$1, m as CacheEncryption, n as DiskCacheEntry, D as DiskBackpressureStats, o as IRedisDriver, p as IRedisPipeline } from './types-B_QkVwJ7.js';
3
- export { b as CacheHealthStatus, a as CacheMetrics, C as CacheOptions, f as CachePingResult, c as CachePresetType, d as CrossRegionInvalidationEvent, q as CrossRegionRelayOptions, E as EncryptionMode, r as EnvelopeEncryption, s as EnvelopeEncryptionOptions, H as HttpMeshRelayOptions, t as HttpSnapshotAdapterOptions, u as ICacheBatchObservableCallback, v as ICacheCounter, w as ICacheMeter, x as ICacheObservableGauge, y as ICacheSpan, z as ICacheSpanLink, I as ICacheTracer, A as ICrossRegionRelay, L as LockOptions, R as RemoteSnapshotOptions, B as WebhookRequestLike, F as WebhookResponseLike, W as WrapOptions, G as consoleLogger, J as createCrossRegionWebhookHandler, K as createCustomCrossRegionRelay, M as createCustomSnapshotAdapter, N as createHttpMeshRelay, O as createHttpSnapshotAdapter, P as createMemoryCrossRegionRelay, Q as createMemorySnapshotAdapter } from './types-B_QkVwJ7.js';
1
+ export { C as CacheService, I as IIpcCacheProvider, a as IpcMetricsPayload, b as IpcTelemetryClient, c as IpcTelemetryServer, L as LatencyWatchdogOptions, d as LatencyWatchdogTelemetry, P as ProcessTerminationBus, T as TierLatencyWatchdog, e as deepMergeOptions, f as findActiveSockets, g as formatBytes, h as formatDuration, i as formatNumber, r as renderProgressBar, j as renderTopDashboard, k as resolveIpcSocketPath } from './cache-service-CREOp7MM.js';
2
+ import { j as IRemoteSnapshotAdapter, k as CategoryLimit, S as SmartCacheEntry, l as EvictionReason, i as ILogger, m as CacheHit, f as CachePriority, h as WTinyLfuStats$1, n as CacheEncryption, o as CompressionAlgorithm, p as DiskCacheEntry, D as DiskBackpressureStats, q as IRedisDriver, r as IRedisPipeline } from './types-Dyip5wAl.js';
3
+ export { c as CacheHealthStatus, b as CacheMetrics, C as CacheOptions, g as CachePingResult, d as CachePresetType, e as CrossRegionInvalidationEvent, s as CrossRegionRelayOptions, t as CustomCompressor, E as EncryptionMode, u as EnvelopeEncryption, v as EnvelopeEncryptionOptions, H as HttpMeshRelayOptions, w as HttpSnapshotAdapterOptions, x as ICacheBatchObservableCallback, y as ICacheCounter, z as ICacheMeter, A as ICacheObservableGauge, B as ICacheSpan, F as ICacheSpanLink, I as ICacheTracer, G as ICrossRegionRelay, a as InvalidateTagOptions, L as LockOptions, R as RemoteSnapshotOptions, J as WebhookRequestLike, K as WebhookResponseLike, W as WrapOptions, M as consoleLogger, N as createCrossRegionWebhookHandler, O as createCustomCrossRegionRelay, P as createCustomSnapshotAdapter, Q as createHttpMeshRelay, T as createHttpSnapshotAdapter, U as createMemoryCrossRegionRelay, V as createMemorySnapshotAdapter, X as initZstd } from './types-Dyip5wAl.js';
4
4
  export { B as BloomFilterStats, M as Murmur3BloomFilter, W as WasmBloomFilter, m as murmur3_32 } from './murmur3-CMGw9PbV.js';
5
5
  import { EventEmitter } from 'node:events';
6
6
  export { DashboardActionEvent, DashboardOptions, DashboardPeerInstance, StandaloneDashboardOptions, createNextDashboardHandlers, handleDashboardRequest, startDashboardServer, tricacheDashboard } from './dashboard/index.js';
@@ -203,7 +203,7 @@ declare class SmartMemoryCache {
203
203
  private maybeRebuildBloom;
204
204
  private smartEvict;
205
205
  get(key: string): CacheHit | null;
206
- set(key: string, data: unknown, ttlMs: number, priority?: CachePriority, staleAt?: number, delta?: number, tagVersions?: Record<string, number>): void;
206
+ set(key: string, data: unknown, ttlMs: number, priority?: CachePriority, staleAt?: number, delta?: number, tagVersions?: Record<string, number>, setAt?: number): void;
207
207
  delete(key: string): boolean;
208
208
  private keysMatchingPattern;
209
209
  deletePattern(pattern: string): number;
@@ -556,8 +556,6 @@ declare class WTinyLfuPolicy {
556
556
  getSegment(key: string): 'window' | 'probation' | 'protected' | null;
557
557
  }
558
558
 
559
- type CompressionAlgorithm = 'brotli' | 'gzip' | 'none';
560
-
561
559
  /**
562
560
  * DiskTier — L1.5 NVMe-fast overflow cache between L1 RAM and L2 Redis/DB.
563
561
  *
@@ -826,6 +824,7 @@ declare class NodeRedisAdapter implements IRedisDriver {
826
824
  sadd(key: string, ...members: string[]): Promise<number>;
827
825
  mget(keys: string[]): Promise<(string | null)[]>;
828
826
  hset(key: string, value: Record<string, string>): Promise<unknown>;
827
+ hgetall(key: string): Promise<Record<string, string>>;
829
828
  publish(channel: string, message: string): Promise<number>;
830
829
  subscribe(...channels: string[]): Promise<unknown>;
831
830
  scanStream(options?: {
@@ -942,4 +941,35 @@ declare function parseTraceParent(header: string | undefined | null): ParsedTrac
942
941
  */
943
942
  declare function formatTraceParent(traceId: string, spanId: string, traceFlags?: number): string;
944
943
 
945
- export { AutoPipeliner, type AutoPipelinerOptions, type AutonomousL1Options, CacheCodec, type CacheCodecOptions, CacheEncryption, CacheHit, CachePriority, CategoryLimit, type CompressionAlgorithm, DEFAULT_AUTONOMOUS_L1_CEILING_BYTES, DiskCacheEntry, DiskTier, EvictionReason, type EvictionResult, ILogger, IRedisDriver, IRedisPipeline, IRemoteSnapshotAdapter, MIN_AUTONOMOUS_L1_FLOOR_BYTES, NodeRedisAdapter, type ParsedTraceParent, SigV4SnapshotAdapter, type SigV4SnapshotAdapterOptions, SmartCacheEntry, SmartMemoryCache, TinyLfuSketch, WTinyLfuCache, type WTinyLfuOptions, WTinyLfuPolicy, type WTinyLfuStats, createNodeRedisAdapter, createR2SnapshotAdapter, createS3SnapshotAdapter, createSigV4SnapshotAdapter, defaultCodec, formatTraceParent, getV8HeapLimit, parseTraceParent, readCgroupMemoryLimit, resolveAutonomousL1MaxBytes, resolveDefaultDiskDir };
944
+ /**
945
+ * Utilities for wildcard matching and hierarchical cascading of cache tags.
946
+ */
947
+ /**
948
+ * Returns true if the given tag contains glob wildcard characters ('*' or '?').
949
+ */
950
+ declare function isWildcardTag(tag: string): boolean;
951
+ /**
952
+ * Matches a tag name against a pattern supporting '*' (0 or more chars) and '?' (single char).
953
+ * Optimized with fast-paths for exact match, universal wildcard, and single prefix/suffix wildcards.
954
+ */
955
+ declare function matchesTagPattern(pattern: string, tag: string): boolean;
956
+ /**
957
+ * Determines whether `candidateTag` is either identical to `parentTag`
958
+ * or a child descendant in the hierarchy separated by `delimiter`.
959
+ *
960
+ * Example:
961
+ * isChildTag('org:123', 'org:123', ':') -> true
962
+ * isChildTag('org:123', 'org:123:dept', ':') -> true
963
+ * isChildTag('org:123', 'org:1234', ':') -> false (must match delimiter boundary)
964
+ */
965
+ declare function isChildTag(parentTag: string, candidateTag: string, delimiter?: string): boolean;
966
+ /**
967
+ * Expands hierarchical tags into all ancestor namespace levels.
968
+ *
969
+ * Example:
970
+ * expandHierarchicalTags(['org:123:dept:456', 'role:admin'], ':')
971
+ * => ['org', 'org:123', 'org:123:dept', 'org:123:dept:456', 'role', 'role:admin']
972
+ */
973
+ declare function expandHierarchicalTags(tags: string[], delimiter?: string): string[];
974
+
975
+ export { AutoPipeliner, type AutoPipelinerOptions, type AutonomousL1Options, CacheCodec, type CacheCodecOptions, CacheEncryption, CacheHit, CachePriority, CategoryLimit, CompressionAlgorithm, DEFAULT_AUTONOMOUS_L1_CEILING_BYTES, DiskCacheEntry, DiskTier, EvictionReason, type EvictionResult, ILogger, IRedisDriver, IRedisPipeline, IRemoteSnapshotAdapter, MIN_AUTONOMOUS_L1_FLOOR_BYTES, NodeRedisAdapter, type ParsedTraceParent, SigV4SnapshotAdapter, type SigV4SnapshotAdapterOptions, SmartCacheEntry, SmartMemoryCache, TinyLfuSketch, WTinyLfuCache, type WTinyLfuOptions, WTinyLfuPolicy, type WTinyLfuStats, createNodeRedisAdapter, createR2SnapshotAdapter, createS3SnapshotAdapter, createSigV4SnapshotAdapter, defaultCodec, expandHierarchicalTags, formatTraceParent, getV8HeapLimit, isChildTag, isWildcardTag, matchesTagPattern, parseTraceParent, readCgroupMemoryLimit, resolveAutonomousL1MaxBytes, resolveDefaultDiskDir };
package/dist/index.js CHANGED
@@ -14,7 +14,7 @@ import {
14
14
  createSigV4SnapshotAdapter,
15
15
  formatTraceParent,
16
16
  parseTraceParent
17
- } from "./chunk-QNU7B43J.js";
17
+ } from "./chunk-3I5L7K6I.js";
18
18
  import {
19
19
  AutoPipeliner,
20
20
  CacheCodec,
@@ -43,13 +43,14 @@ import {
43
43
  resolveAutonomousL1MaxBytes,
44
44
  resolveDefaultDiskDir,
45
45
  resolveIpcSocketPath
46
- } from "./chunk-PL5J3ZNT.js";
46
+ } from "./chunk-JYQFQJNJ.js";
47
47
  import {
48
48
  CacheEncryption,
49
49
  CachePriority,
50
50
  EnvelopeEncryption,
51
- consoleLogger
52
- } from "./chunk-LJ5QJB5O.js";
51
+ consoleLogger,
52
+ initZstd
53
+ } from "./chunk-UBWLPKTI.js";
53
54
  import {
54
55
  createNextDashboardHandlers,
55
56
  handleDashboardRequest,
@@ -61,8 +62,12 @@ import {
61
62
  murmur3_32
62
63
  } from "./chunk-UGD4VEPD.js";
63
64
  import {
64
- WasmBloomFilter
65
- } from "./chunk-XZL45ABR.js";
65
+ WasmBloomFilter,
66
+ expandHierarchicalTags,
67
+ isChildTag,
68
+ isWildcardTag,
69
+ matchesTagPattern
70
+ } from "./chunk-2AJKEQMZ.js";
66
71
  export {
67
72
  AutoPipeliner,
68
73
  CacheCodec,
@@ -100,6 +105,7 @@ export {
100
105
  createSigV4SnapshotAdapter,
101
106
  deepMergeOptions,
102
107
  defaultCodec,
108
+ expandHierarchicalTags,
103
109
  findActiveSockets,
104
110
  formatBytes,
105
111
  formatDuration,
@@ -107,6 +113,10 @@ export {
107
113
  formatTraceParent,
108
114
  getV8HeapLimit,
109
115
  handleDashboardRequest,
116
+ initZstd,
117
+ isChildTag,
118
+ isWildcardTag,
119
+ matchesTagPattern,
110
120
  murmur3_32,
111
121
  parseTraceParent,
112
122
  readCgroupMemoryLimit,