-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.d.ts
39 lines (28 loc) · 925 Bytes
/
index.d.ts
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
import { RedisClient } from 'redis';
import { RequestHandler } from 'express';
export interface Config {
isEnable?: boolean;
ttl?: number;
file?: {
path?: string;
};
redis?: {
port?: number;
host?: string;
client?: RedisClient;
setex?: Function;
password?: string;
database?: string;
prefix?: string;
}
}
export type Status = { status: 0 | 1 }
export function init(config?: Config): Promise<void>;
export function set(key: string, value: any, time?: number): Promise<Status>;
export function get(key: string): Promise<any>;
export function getAll(): Promise<Array<any>>;
export function has(key: string): Promise<boolean>;
export function remove(key: string): Promise<Status>;
export function removeByPattern(pattern: string | RegExp): Promise<Status>;
export function clear(): Promise<Status>;
export function middleware(time: number, prefix?: string): RequestHandler;