-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.d.ts
More file actions
86 lines (60 loc) · 1.85 KB
/
index.d.ts
File metadata and controls
86 lines (60 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import { EventEmitter, Writable } from "node:stream";
import { RedisOptions } from "iovalkey";
import { GetResult, CacheKey, CachedResponse } from "./lib/internal-types";
export interface RedisCacheStoreOpts {
clientConfigTracking?: boolean
clientOpts?: RedisOptions
maxEntrySize?: number
maxSize?: number
maxCount?: number
/**
* Redis client-side caching
* @see https://redis.io/docs/latest/develop/reference/client-side-caching/
* @default true
*/
tracking?: boolean
cacheTagsHeader?: string
errorCallback?: (err: Error) => void
}
export interface RedisCacheManagerOpts {
clientConfigKeyspaceEventNotify?: boolean
clientOpts?: RedisOptions
}
declare class RedisCacheStore extends EventEmitter {
constructor(opts?: RedisCacheStoreOpts);
get(key: CacheKey): Promise<GetResult | undefined>
createWriteStream(key: CacheKey, value: CachedResponse): Writable
delete(key: CacheKey): Promise<void>
deleteKeys(keys: CacheKey[]): Promise<void>
deleteTags(tags: string[]): Promise<void>
close(): Promise<void>
}
export interface CacheEntry {
id: string;
keyPrefix: string;
origin: string;
path: string;
method: string;
statusCode: number;
headers: Record<string, string | string[]>;
cacheTags: string[];
cachedAt: number;
staleAt: number;
deleteAt: number;
}
declare class RedisCacheManager extends EventEmitter{
constructor(opts?: RedisCacheManagerOpts);
streamEntries(
callback: (entry: CacheEntry) => Promise<unknown> | unknown,
keyPrefix: string,
): Promise<void>
subscribe(): Promise<void>
getResponseById(id: string, keyPrefix: string): Promise<string | null>
getDependentEntries(id: string, keyPrefix: string): Promise<CacheEntry[]>
deleteIds (ids: string[], keyPrefix: string): Promise<void>
close(): Promise<void>
}
export {
RedisCacheStore,
RedisCacheManager
}