tricache 1.0.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.
- package/README.md +1 -1
- package/dist/{cache-service-pJ-nFcVj.d.ts → cache-service-CREOp7MM.d.ts} +29 -1
- package/dist/{cache-service-26GCO3UU.js → cache-service-MG7PN6MX.js} +1 -1
- package/dist/{chunk-VXFTFZ5N.js → chunk-3I5L7K6I.js} +17 -0
- package/dist/{chunk-7SZSQS55.js → chunk-JYQFQJNJ.js} +533 -295
- package/dist/cli.cjs +534 -296
- package/dist/cli.js +2 -2
- package/dist/dashboard/index.d.ts +2 -2
- package/dist/drizzle/index.cjs +533 -295
- package/dist/drizzle/index.d.ts +2 -2
- package/dist/drizzle/index.js +1 -1
- package/dist/edge/index.cjs +55 -32
- package/dist/edge/index.d.ts +3 -3
- package/dist/edge/index.js +55 -32
- package/dist/hono/index.cjs +533 -295
- package/dist/hono/index.d.ts +2 -2
- package/dist/hono/index.js +1 -1
- package/dist/{hono-DuNvciyq.d.ts → hono-DSV2ve66.d.ts} +8 -1
- package/dist/http/index.cjs +585 -316
- package/dist/http/index.d.ts +3 -3
- package/dist/http/index.js +55 -24
- package/dist/index.cjs +550 -295
- package/dist/index.d.ts +5 -4
- package/dist/index.js +2 -2
- package/dist/nestjs/index.cjs +533 -295
- package/dist/nestjs/index.d.ts +2 -2
- package/dist/nestjs/index.js +2 -2
- package/dist/next/index.cjs +535 -303
- package/dist/next/index.d.ts +2 -2
- package/dist/next/index.js +3 -9
- package/dist/prisma/index.d.ts +2 -2
- package/dist/{types-5HXqBfAf.d.ts → types-Dyip5wAl.d.ts} +2 -0
- package/package.json +1 -1
- package/src/adapters/node-redis.ts +19 -0
- package/src/cache-service.ts +599 -320
- package/src/cli.ts +1 -1
- package/src/edge/cache.ts +60 -35
- package/src/http/express.ts +55 -16
- package/src/http/fastify.ts +3 -7
- package/src/next/cache-handler.ts +1 -4
- package/src/next/isr-handler.ts +1 -4
- package/src/smart-memory-cache.ts +3 -2
- package/src/types.ts +2 -0
package/dist/next/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CacheService } from '../cache-service-
|
|
2
|
-
import { C as CacheOptions, i as ILogger } from '../types-
|
|
1
|
+
import { C as CacheService } from '../cache-service-CREOp7MM.js';
|
|
2
|
+
import { C as CacheOptions, i as ILogger } from '../types-Dyip5wAl.js';
|
|
3
3
|
import 'crypto';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/next/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CacheService
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-JYQFQJNJ.js";
|
|
4
4
|
import {
|
|
5
5
|
consoleLogger
|
|
6
6
|
} from "../chunk-UBWLPKTI.js";
|
|
@@ -76,10 +76,7 @@ var TriCacheHandler = class {
|
|
|
76
76
|
* and returns a fresh unlocked ReadableStream if the stored value was a stream.
|
|
77
77
|
*/
|
|
78
78
|
async get(cacheKey, ctx) {
|
|
79
|
-
const stored = await this.cache.
|
|
80
|
-
cacheKey,
|
|
81
|
-
async () => null
|
|
82
|
-
);
|
|
79
|
+
const stored = await this.cache.peek(cacheKey);
|
|
83
80
|
if (!stored || stored.data == null) {
|
|
84
81
|
return void 0;
|
|
85
82
|
}
|
|
@@ -232,10 +229,7 @@ var TriCacheISRHandler = class {
|
|
|
232
229
|
if (this.requestCache.has(key)) {
|
|
233
230
|
return this.requestCache.get(key) ?? null;
|
|
234
231
|
}
|
|
235
|
-
const stored = await this.cache.
|
|
236
|
-
key,
|
|
237
|
-
async () => null
|
|
238
|
-
);
|
|
232
|
+
const stored = await this.cache.peek(key);
|
|
239
233
|
if (stored) {
|
|
240
234
|
this.requestCache.set(key, stored);
|
|
241
235
|
return stored;
|
package/dist/prisma/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CacheService } from '../cache-service-
|
|
2
|
-
import { W as WrapOptions } from '../types-
|
|
1
|
+
import { C as CacheService } from '../cache-service-CREOp7MM.js';
|
|
2
|
+
import { W as WrapOptions } from '../types-Dyip5wAl.js';
|
|
3
3
|
import 'crypto';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1436,6 +1436,7 @@ interface IRedisPipeline {
|
|
|
1436
1436
|
sadd(key: string, ...members: string[]): this;
|
|
1437
1437
|
smembers(key: string): this;
|
|
1438
1438
|
hset(key: string, value: Record<string, string>): this;
|
|
1439
|
+
hgetall?(key: string): this;
|
|
1439
1440
|
exec(): Promise<Array<[Error | null, any]> | null>;
|
|
1440
1441
|
}
|
|
1441
1442
|
/**
|
|
@@ -1461,6 +1462,7 @@ interface IRedisDriver {
|
|
|
1461
1462
|
count?: number;
|
|
1462
1463
|
}): any;
|
|
1463
1464
|
hset?(key: string, value: Record<string, string>): Promise<unknown>;
|
|
1465
|
+
hgetall?(key: string): Promise<Record<string, string>>;
|
|
1464
1466
|
publish?(channel: string, message: string): Promise<number>;
|
|
1465
1467
|
subscribe?(...channels: string[]): Promise<unknown>;
|
|
1466
1468
|
disconnect(): Promise<void> | void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tricache",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Three-tier Node.js cache: L1 smart RAM (adaptive LFU/LRU + Count-Min Sketch) → L1.5 NVMe disk spill → L2 Redis/Valkey. Includes AES-256-GCM at-rest encryption, WASM Bloom filter, Stale-While-Revalidate, and thundering-herd prevention.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cache",
|
|
@@ -84,6 +84,15 @@ export class NodeRedisPipelineAdapter implements IRedisPipeline {
|
|
|
84
84
|
return this;
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
hgetall(key: string): this {
|
|
88
|
+
if (typeof this.multiInstance.hGetAll === 'function') {
|
|
89
|
+
this.multiInstance.hGetAll(key);
|
|
90
|
+
} else {
|
|
91
|
+
this.multiInstance.hgetall(key);
|
|
92
|
+
}
|
|
93
|
+
return this;
|
|
94
|
+
}
|
|
95
|
+
|
|
87
96
|
async exec(): Promise<Array<[Error | null, any]> | null> {
|
|
88
97
|
const raw = await this.multiInstance.exec();
|
|
89
98
|
if (!raw) return null;
|
|
@@ -252,6 +261,16 @@ export class NodeRedisAdapter implements IRedisDriver {
|
|
|
252
261
|
return undefined;
|
|
253
262
|
}
|
|
254
263
|
|
|
264
|
+
async hgetall(key: string): Promise<Record<string, string>> {
|
|
265
|
+
if (typeof this.client.hGetAll === 'function') {
|
|
266
|
+
return (await this.client.hGetAll(key)) ?? {};
|
|
267
|
+
}
|
|
268
|
+
if (typeof this.client.hgetall === 'function') {
|
|
269
|
+
return (await this.client.hgetall(key)) ?? {};
|
|
270
|
+
}
|
|
271
|
+
return {};
|
|
272
|
+
}
|
|
273
|
+
|
|
255
274
|
async publish(channel: string, message: string): Promise<number> {
|
|
256
275
|
return await this.client.publish(channel, message);
|
|
257
276
|
}
|