akanjs 2.3.8-rc.3 → 2.3.8-rc.4
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/document/database.ts +3 -7
- package/package.json +1 -1
- package/service/injectInfo.ts +26 -12
- package/service/predefinedAdaptor/cache.adaptor.ts +8 -9
- package/service/predefinedAdaptor/solidCache.adaptor.ts +3 -4
- package/types/document/database.d.ts +3 -6
- package/types/service/injectInfo.d.ts +8 -4
- package/types/service/predefinedAdaptor/cache.adaptor.d.ts +7 -12
- package/types/service/predefinedAdaptor/solidCache.adaptor.d.ts +3 -8
package/document/database.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MergedValues, PromiseOrObject } from "akanjs/base";
|
|
2
2
|
import { Logger } from "akanjs/common";
|
|
3
3
|
import type { DocumentModel, QueryOf } from "akanjs/constant";
|
|
4
|
-
import type { CacheAdaptor } from "akanjs/service";
|
|
4
|
+
import type { CacheAdaptor, CacheSetOptions } from "akanjs/service";
|
|
5
5
|
import type { DataLoader } from "./dataLoader";
|
|
6
6
|
import type { ExtractQuery, ExtractSort, FilterInstance } from "./filterMeta";
|
|
7
7
|
import type { CRUDEventType, Mdl, SaveEventType } from "./into";
|
|
8
8
|
import type { DataInputOf, FindQueryOption, ListQueryOption } from "./types";
|
|
9
9
|
|
|
10
|
-
export interface RedisSetOptions {
|
|
11
|
-
expireAt?: Dayjs;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
10
|
export class CacheDatabase<T = unknown> {
|
|
15
11
|
private logger: Logger;
|
|
16
12
|
constructor(
|
|
@@ -19,7 +15,7 @@ export class CacheDatabase<T = unknown> {
|
|
|
19
15
|
) {
|
|
20
16
|
this.logger = new Logger(`${refName}Cache`);
|
|
21
17
|
}
|
|
22
|
-
async set(topic: string, key: string, value: string | number | Buffer, option:
|
|
18
|
+
async set(topic: string, key: string, value: string | number | Buffer, option: CacheSetOptions = {}) {
|
|
23
19
|
await this.cache.set(this.refName, `${topic}:${key}`, value, option);
|
|
24
20
|
}
|
|
25
21
|
async get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined> {
|
package/package.json
CHANGED
package/service/injectInfo.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
SliceCls,
|
|
17
17
|
} from "akanjs/signal";
|
|
18
18
|
import type { Adaptor, AdaptorCls, Service, ServiceCls } from ".";
|
|
19
|
-
import type { CacheAdaptor } from "./predefinedAdaptor";
|
|
19
|
+
import type { CacheAdaptor, CacheSetOptions } from "./predefinedAdaptor";
|
|
20
20
|
|
|
21
21
|
export type InjectType = "database" | "service" | "use" | "signal" | "plug" | "env" | "memory";
|
|
22
22
|
|
|
@@ -29,6 +29,7 @@ interface InjectBuilderOptions<ReturnType> {
|
|
|
29
29
|
local?: boolean;
|
|
30
30
|
default?: unknown;
|
|
31
31
|
isMap?: boolean;
|
|
32
|
+
cacheOption?: CacheSetOptions;
|
|
32
33
|
parentRefName: string;
|
|
33
34
|
}
|
|
34
35
|
|
|
@@ -99,6 +100,7 @@ export class InjectInfo<
|
|
|
99
100
|
readonly adaptor?: AdaptorCls;
|
|
100
101
|
readonly default?: unknown;
|
|
101
102
|
readonly isMap?: boolean;
|
|
103
|
+
readonly cacheOption?: CacheSetOptions;
|
|
102
104
|
readonly parentRefName: string;
|
|
103
105
|
constructor(type: Type, options: InjectBuilderOptions<ReturnType>) {
|
|
104
106
|
this.type = type;
|
|
@@ -110,6 +112,7 @@ export class InjectInfo<
|
|
|
110
112
|
this.set = options.set;
|
|
111
113
|
this.default = options.default;
|
|
112
114
|
this.isMap = options.isMap ?? false;
|
|
115
|
+
this.cacheOption = options.cacheOption;
|
|
113
116
|
this.parentRefName = options.parentRefName;
|
|
114
117
|
}
|
|
115
118
|
static async resolveInjection(
|
|
@@ -261,9 +264,9 @@ export class InjectInfo<
|
|
|
261
264
|
const value = await cacheAdaptor.hget(topic, propKey, key);
|
|
262
265
|
return value === undefined || value === null ? undefined : getter(value);
|
|
263
266
|
};
|
|
264
|
-
const set = async (key: string, value: unknown) => {
|
|
267
|
+
const set = async (key: string, value: unknown, option?: CacheSetOptions) => {
|
|
265
268
|
const setValue = setter(value);
|
|
266
|
-
await cacheAdaptor.hset(topic, propKey, key, setValue);
|
|
269
|
+
await cacheAdaptor.hset(topic, propKey, key, setValue, option ?? injectInfo.cacheOption);
|
|
267
270
|
};
|
|
268
271
|
Object.defineProperty(instance, propKey, {
|
|
269
272
|
value: {
|
|
@@ -272,17 +275,21 @@ export class InjectInfo<
|
|
|
272
275
|
delete: async (key: string) => {
|
|
273
276
|
await cacheAdaptor.hdelete(topic, propKey, key);
|
|
274
277
|
},
|
|
275
|
-
getOrInsert: async (key: string, value: unknown) => {
|
|
278
|
+
getOrInsert: async (key: string, value: unknown, option?: CacheSetOptions) => {
|
|
276
279
|
const existingValue = await get(key);
|
|
277
280
|
if (existingValue !== undefined) return existingValue;
|
|
278
|
-
await set(key, value);
|
|
281
|
+
await set(key, value, option);
|
|
279
282
|
return value;
|
|
280
283
|
},
|
|
281
|
-
getOrInsertComputed: async (
|
|
284
|
+
getOrInsertComputed: async (
|
|
285
|
+
key: string,
|
|
286
|
+
compute: (key: string) => unknown | Promise<unknown>,
|
|
287
|
+
option?: CacheSetOptions,
|
|
288
|
+
) => {
|
|
282
289
|
const existingValue = await get(key);
|
|
283
290
|
if (existingValue !== undefined) return existingValue;
|
|
284
291
|
const value = await compute(key);
|
|
285
|
-
await set(key, value);
|
|
292
|
+
await set(key, value, option);
|
|
286
293
|
return value;
|
|
287
294
|
},
|
|
288
295
|
keys: async () => await cacheAdaptor.hkeys(topic, propKey),
|
|
@@ -306,10 +313,10 @@ export class InjectInfo<
|
|
|
306
313
|
const value = await cacheAdaptor.get("akan:memory", propKey);
|
|
307
314
|
return value === null ? value : getter(value);
|
|
308
315
|
},
|
|
309
|
-
set: async (value: unknown) => {
|
|
316
|
+
set: async (value: unknown, option?: CacheSetOptions) => {
|
|
310
317
|
const setter = injectInfo.set as unknown as (value: unknown) => string | number | Buffer;
|
|
311
318
|
const setValue = setter(value);
|
|
312
|
-
await cacheAdaptor.set("akan:memory", propKey, setValue);
|
|
319
|
+
await cacheAdaptor.set("akan:memory", propKey, setValue, option ?? injectInfo.cacheOption);
|
|
313
320
|
},
|
|
314
321
|
delete: async () => {
|
|
315
322
|
await cacheAdaptor.delete("akan:memory", propKey);
|
|
@@ -362,6 +369,7 @@ export const injectionBuilder = (parentRefName: string) => ({
|
|
|
362
369
|
local?: Local;
|
|
363
370
|
default?: DefaultValue;
|
|
364
371
|
of?: MapValue;
|
|
372
|
+
expireAt?: CacheSetOptions["expireAt"];
|
|
365
373
|
get?: GetFn;
|
|
366
374
|
set?: (value: ReturnType<GetFn>) => GetFieldValue<ValueRef, ExplicitType>;
|
|
367
375
|
} = {},
|
|
@@ -385,19 +393,24 @@ export const injectionBuilder = (parentRefName: string) => ({
|
|
|
385
393
|
: MapConstructor extends ValueRef
|
|
386
394
|
? {
|
|
387
395
|
get: (key: string) => Promise<MapFieldValue | undefined>;
|
|
388
|
-
set: (key: string, value: MapFieldValue) => Promise<void>;
|
|
396
|
+
set: (key: string, value: MapFieldValue, option?: CacheSetOptions) => Promise<void>;
|
|
389
397
|
delete: (key: string) => Promise<void>;
|
|
390
|
-
getOrInsert: (key: string, value: MapFieldValue) => Promise<MapFieldValue>;
|
|
398
|
+
getOrInsert: (key: string, value: MapFieldValue, option?: CacheSetOptions) => Promise<MapFieldValue>;
|
|
391
399
|
getOrInsertComputed: (
|
|
392
400
|
key: string,
|
|
393
401
|
compute: (key: string) => MapFieldValue | Promise<MapFieldValue>,
|
|
402
|
+
option?: CacheSetOptions,
|
|
394
403
|
) => Promise<MapFieldValue>;
|
|
395
404
|
keys: () => Promise<string[]>;
|
|
396
405
|
entries: () => Promise<[string, MapFieldValue][]>;
|
|
397
406
|
forEach: (callback: (value: MapFieldValue, key: string) => void | Promise<void>) => Promise<void>;
|
|
398
407
|
clear: () => Promise<void>;
|
|
399
408
|
}
|
|
400
|
-
: {
|
|
409
|
+
: {
|
|
410
|
+
get: () => Promise<UseValue>;
|
|
411
|
+
set: (value: UseValue, option?: CacheSetOptions) => Promise<void>;
|
|
412
|
+
delete: () => Promise<void>;
|
|
413
|
+
},
|
|
401
414
|
never,
|
|
402
415
|
ValueRef
|
|
403
416
|
>("memory", {
|
|
@@ -416,6 +429,7 @@ export const injectionBuilder = (parentRefName: string) => ({
|
|
|
416
429
|
},
|
|
417
430
|
default: opts.default as unknown,
|
|
418
431
|
isMap,
|
|
432
|
+
cacheOption: opts.expireAt ? { expireAt: opts.expireAt } : undefined,
|
|
419
433
|
parentRefName,
|
|
420
434
|
});
|
|
421
435
|
},
|
|
@@ -2,8 +2,12 @@ import type { BaseEnv, Dayjs, SshOptions } from "akanjs/base";
|
|
|
2
2
|
import type { Redis } from "ioredis";
|
|
3
3
|
import { adapt } from "../adapt";
|
|
4
4
|
|
|
5
|
+
export interface CacheSetOptions {
|
|
6
|
+
expireAt?: Dayjs;
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
export interface CacheAdaptor {
|
|
6
|
-
set(topic: string, key: string, value: string | number | Buffer, option?:
|
|
10
|
+
set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
|
|
7
11
|
get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
|
|
8
12
|
delete(topic: string, key: string): Promise<void>;
|
|
9
13
|
getClient?(): Redis;
|
|
@@ -12,7 +16,7 @@ export interface CacheAdaptor {
|
|
|
12
16
|
key: string,
|
|
13
17
|
subKey: string,
|
|
14
18
|
value: string | number | Buffer,
|
|
15
|
-
option?:
|
|
19
|
+
option?: CacheSetOptions,
|
|
16
20
|
): Promise<void>;
|
|
17
21
|
hget<T extends string | number | Buffer>(topic: string, key: string, subKey: string): Promise<T | undefined>;
|
|
18
22
|
hdelete(topic: string, key: string, subKey: string): Promise<void>;
|
|
@@ -63,12 +67,7 @@ export class RedisCache
|
|
|
63
67
|
}))
|
|
64
68
|
implements CacheAdaptor
|
|
65
69
|
{
|
|
66
|
-
async set(
|
|
67
|
-
topic: string,
|
|
68
|
-
key: string,
|
|
69
|
-
value: string | number | Buffer,
|
|
70
|
-
option: { expireAt?: Dayjs } = {},
|
|
71
|
-
): Promise<void> {
|
|
70
|
+
async set(topic: string, key: string, value: string | number | Buffer, option: CacheSetOptions = {}): Promise<void> {
|
|
72
71
|
const expireTime = option.expireAt?.toDate().getTime();
|
|
73
72
|
if (expireTime) await this.redis.set(`${topic}:${key}`, value, "PXAT", expireTime);
|
|
74
73
|
else await this.redis.set(`${topic}:${key}`, value);
|
|
@@ -85,7 +84,7 @@ export class RedisCache
|
|
|
85
84
|
key: string,
|
|
86
85
|
subKey: string,
|
|
87
86
|
value: string | number | Buffer,
|
|
88
|
-
option?:
|
|
87
|
+
option?: CacheSetOptions,
|
|
89
88
|
): Promise<void> {
|
|
90
89
|
const expireTime = option?.expireAt?.toDate().getTime();
|
|
91
90
|
const redisKey = `${topic}:${key}`;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Database } from "bun:sqlite";
|
|
2
|
-
import type { Dayjs } from "akanjs/base";
|
|
3
2
|
import { adapt } from "../adapt";
|
|
4
|
-
import type { CacheAdaptor } from "./cache.adaptor";
|
|
3
|
+
import type { CacheAdaptor, CacheSetOptions } from "./cache.adaptor";
|
|
5
4
|
import {
|
|
6
5
|
decodeSolidValue,
|
|
7
6
|
encodeSolidValue,
|
|
@@ -62,7 +61,7 @@ export class SolidCache
|
|
|
62
61
|
this.#db?.close();
|
|
63
62
|
}
|
|
64
63
|
|
|
65
|
-
async set(topic: string, key: string, value: string | number | Buffer, option:
|
|
64
|
+
async set(topic: string, key: string, value: string | number | Buffer, option: CacheSetOptions = {}) {
|
|
66
65
|
const encoded = encodeSolidValue(value);
|
|
67
66
|
const now = Date.now();
|
|
68
67
|
this.#db
|
|
@@ -99,7 +98,7 @@ export class SolidCache
|
|
|
99
98
|
key: string,
|
|
100
99
|
subKey: string,
|
|
101
100
|
value: string | number | Buffer,
|
|
102
|
-
option:
|
|
101
|
+
option: CacheSetOptions = {},
|
|
103
102
|
) {
|
|
104
103
|
const encoded = encodeSolidValue(value);
|
|
105
104
|
const now = Date.now();
|
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { MergedValues, PromiseOrObject } from "akanjs/base";
|
|
2
2
|
import { Logger } from "akanjs/common";
|
|
3
3
|
import type { DocumentModel, QueryOf } from "akanjs/constant";
|
|
4
|
-
import type { CacheAdaptor } from "akanjs/service";
|
|
4
|
+
import type { CacheAdaptor, CacheSetOptions } from "akanjs/service";
|
|
5
5
|
import type { DataLoader } from "./dataLoader.d.ts";
|
|
6
6
|
import type { ExtractQuery, ExtractSort, FilterInstance } from "./filterMeta.d.ts";
|
|
7
7
|
import type { CRUDEventType, Mdl, SaveEventType } from "./into.d.ts";
|
|
8
8
|
import type { DataInputOf, FindQueryOption, ListQueryOption } from "./types.d.ts";
|
|
9
|
-
export interface RedisSetOptions {
|
|
10
|
-
expireAt?: Dayjs;
|
|
11
|
-
}
|
|
12
9
|
export declare class CacheDatabase<T = unknown> {
|
|
13
10
|
private readonly refName;
|
|
14
11
|
private readonly cache;
|
|
15
12
|
private logger;
|
|
16
13
|
constructor(refName: string, cache: CacheAdaptor);
|
|
17
|
-
set(topic: string, key: string, value: string | number | Buffer, option?:
|
|
14
|
+
set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
|
|
18
15
|
get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
|
|
19
16
|
delete(topic: string, key: string): Promise<void>;
|
|
20
17
|
}
|
|
@@ -3,6 +3,7 @@ import { type ConstantFieldTypeInput, type FieldToValue, type PlainTypeToFieldTy
|
|
|
3
3
|
import type { DatabaseModel } from "akanjs/document";
|
|
4
4
|
import type { Endpoint, EndpointCls, Internal, InternalCls, ServerSignal, ServerSignalCls, SliceCls } from "akanjs/signal";
|
|
5
5
|
import type { Adaptor, AdaptorCls, Service, ServiceCls } from ".";
|
|
6
|
+
import type { CacheSetOptions } from "./predefinedAdaptor.d.ts";
|
|
6
7
|
export type InjectType = "database" | "service" | "use" | "signal" | "plug" | "env" | "memory";
|
|
7
8
|
interface InjectBuilderOptions<ReturnType> {
|
|
8
9
|
generateFactory?: (options: any) => ReturnType;
|
|
@@ -13,6 +14,7 @@ interface InjectBuilderOptions<ReturnType> {
|
|
|
13
14
|
local?: boolean;
|
|
14
15
|
default?: unknown;
|
|
15
16
|
isMap?: boolean;
|
|
17
|
+
cacheOption?: CacheSetOptions;
|
|
16
18
|
parentRefName: string;
|
|
17
19
|
}
|
|
18
20
|
export interface InjectRegistry {
|
|
@@ -55,6 +57,7 @@ export declare class InjectInfo<Type extends InjectType = any, ReturnType = any,
|
|
|
55
57
|
readonly adaptor?: AdaptorCls;
|
|
56
58
|
readonly default?: unknown;
|
|
57
59
|
readonly isMap?: boolean;
|
|
60
|
+
readonly cacheOption?: CacheSetOptions;
|
|
58
61
|
readonly parentRefName: string;
|
|
59
62
|
constructor(type: Type, options: InjectBuilderOptions<ReturnType>);
|
|
60
63
|
static resolveInjection(instance: Adaptor | Service, applyCls: AdaptorCls | ServiceCls, registry: InjectRegistry, env: BaseEnv): Promise<void>;
|
|
@@ -73,21 +76,22 @@ export declare const injectionBuilder: (parentRefName: string) => {
|
|
|
73
76
|
local?: Local;
|
|
74
77
|
default?: DefaultValue;
|
|
75
78
|
of?: MapValue;
|
|
79
|
+
expireAt?: CacheSetOptions["expireAt"];
|
|
76
80
|
get?: GetFn;
|
|
77
81
|
set?: (value: ReturnType<GetFn>) => GetFieldValue<ValueRef, ExplicitType>;
|
|
78
82
|
}) => InjectInfo<"memory", Local extends true ? MapConstructor extends ValueRef ? Map<string, FieldToValue<MapValue>> : (DefaultValue extends never ? true : false) extends true ? (never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) | null : never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn> : MapConstructor extends ValueRef ? {
|
|
79
83
|
get: (key: string) => Promise<(never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>) | undefined>;
|
|
80
|
-
set: (key: string, value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn
|
|
84
|
+
set: (key: string, value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>, option?: CacheSetOptions) => Promise<void>;
|
|
81
85
|
delete: (key: string) => Promise<void>;
|
|
82
|
-
getOrInsert: (key: string, value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn
|
|
83
|
-
getOrInsertComputed: (key: string, compute: (key: string) => (never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>) | Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn
|
|
86
|
+
getOrInsert: (key: string, value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>, option?: CacheSetOptions) => Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>;
|
|
87
|
+
getOrInsertComputed: (key: string, compute: (key: string) => (never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>) | Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>, option?: CacheSetOptions) => Promise<never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>>;
|
|
84
88
|
keys: () => Promise<string[]>;
|
|
85
89
|
entries: () => Promise<[string, never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>][]>;
|
|
86
90
|
forEach: (callback: (value: never extends GetFn ? FieldToValue<MapValue> : ReturnType<GetFn>, key: string) => void | Promise<void>) => Promise<void>;
|
|
87
91
|
clear: () => Promise<void>;
|
|
88
92
|
} : {
|
|
89
93
|
get: () => Promise<(DefaultValue extends never ? true : false) extends true ? (never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) | null : never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>>;
|
|
90
|
-
set: (value: (DefaultValue extends never ? true : false) extends true ? (never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) | null : never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn
|
|
94
|
+
set: (value: (DefaultValue extends never ? true : false) extends true ? (never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>) | null : never extends GetFn ? GetFieldValue<ValueRef, ExplicitType, MapValue> : ReturnType<GetFn>, option?: CacheSetOptions) => Promise<void>;
|
|
91
95
|
delete: () => Promise<void>;
|
|
92
96
|
}, never, ValueRef>;
|
|
93
97
|
};
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import type { BaseEnv, Dayjs, SshOptions } from "akanjs/base";
|
|
2
2
|
import type { Redis } from "ioredis";
|
|
3
|
+
export interface CacheSetOptions {
|
|
4
|
+
expireAt?: Dayjs;
|
|
5
|
+
}
|
|
3
6
|
export interface CacheAdaptor {
|
|
4
|
-
set(topic: string, key: string, value: string | number | Buffer, option?:
|
|
5
|
-
expireAt?: Dayjs;
|
|
6
|
-
}): Promise<void>;
|
|
7
|
+
set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
|
|
7
8
|
get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
|
|
8
9
|
delete(topic: string, key: string): Promise<void>;
|
|
9
10
|
getClient?(): Redis;
|
|
10
|
-
hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?:
|
|
11
|
-
expireAt?: Dayjs;
|
|
12
|
-
}): Promise<void>;
|
|
11
|
+
hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
|
|
13
12
|
hget<T extends string | number | Buffer>(topic: string, key: string, subKey: string): Promise<T | undefined>;
|
|
14
13
|
hdelete(topic: string, key: string, subKey: string): Promise<void>;
|
|
15
14
|
hkeys(topic: string, key: string): Promise<string[]>;
|
|
@@ -27,14 +26,10 @@ declare const RedisCache_base: import("..").AdaptorCls<{}, {
|
|
|
27
26
|
redis: import("..").InjectInfo<"env", Redis, RedisEnv, never>;
|
|
28
27
|
}>;
|
|
29
28
|
export declare class RedisCache extends RedisCache_base implements CacheAdaptor {
|
|
30
|
-
set(topic: string, key: string, value: string | number | Buffer, option?:
|
|
31
|
-
expireAt?: Dayjs;
|
|
32
|
-
}): Promise<void>;
|
|
29
|
+
set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
|
|
33
30
|
get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
|
|
34
31
|
delete(topic: string, key: string): Promise<void>;
|
|
35
|
-
hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?:
|
|
36
|
-
expireAt?: Dayjs;
|
|
37
|
-
}): Promise<void>;
|
|
32
|
+
hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
|
|
38
33
|
hget<T extends string | number | Buffer>(topic: string, key: string, subKey: string): Promise<T | undefined>;
|
|
39
34
|
hdelete(topic: string, key: string, subKey: string): Promise<void>;
|
|
40
35
|
hkeys(topic: string, key: string): Promise<string[]>;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CacheAdaptor } from "./cache.adaptor";
|
|
1
|
+
import type { CacheAdaptor, CacheSetOptions } from "./cache.adaptor";
|
|
3
2
|
import { type SolidConfig, type SolidEnv } from "./solidSqlite.d.ts";
|
|
4
3
|
declare const SolidCache_base: import("..").AdaptorCls<{}, {
|
|
5
4
|
config: import("..").InjectInfo<"env", Required<SolidConfig>, SolidEnv, never>;
|
|
@@ -8,14 +7,10 @@ export declare class SolidCache extends SolidCache_base implements CacheAdaptor
|
|
|
8
7
|
#private;
|
|
9
8
|
onInit(): Promise<void>;
|
|
10
9
|
onDestroy(): Promise<void>;
|
|
11
|
-
set(topic: string, key: string, value: string | number | Buffer, option?:
|
|
12
|
-
expireAt?: Dayjs;
|
|
13
|
-
}): Promise<void>;
|
|
10
|
+
set(topic: string, key: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
|
|
14
11
|
get<T extends string | number | Buffer>(topic: string, key: string): Promise<T | undefined>;
|
|
15
12
|
delete(topic: string, key: string): Promise<void>;
|
|
16
|
-
hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?:
|
|
17
|
-
expireAt?: Dayjs;
|
|
18
|
-
}): Promise<void>;
|
|
13
|
+
hset(topic: string, key: string, subKey: string, value: string | number | Buffer, option?: CacheSetOptions): Promise<void>;
|
|
19
14
|
hget<T extends string | number | Buffer>(topic: string, key: string, subKey: string): Promise<T | undefined>;
|
|
20
15
|
hdelete(topic: string, key: string, subKey: string): Promise<void>;
|
|
21
16
|
hkeys(topic: string, key: string): Promise<string[]>;
|