forked from aalfiann/recachegoose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
36 lines (29 loc) · 1.05 KB
/
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
//Adopted from on https://github.com/xrip/cachegoose
import { Document, Mongoose } from 'mongoose';
declare module 'recachegoose' {
function cachegoose(mongoose: Mongoose, cacheOptions: cachegoose.Types.IOptions): void;
namespace cachegoose {
namespace Types {
interface IOptions {
engine?: string
count?: number
port?: number
host?: string
password?: string,
client?: any,
}
}
function clearCache(customKey: any, cb: any): void;
}
export = cachegoose;
}
declare module 'mongoose' {
// eslint-disable-next-line @typescript-eslint/class-name-casing
interface DocumentQuery<T, DocType extends Document, QueryHelpers = {}> {
// not cachegoose related fix, but usefull. thanks to https://github.com/DefinitelyTyped/DefinitelyTyped/issues/34205#issuecomment-621976826
orFail(err?: Error | (() => Error)): DocumentQuery<NonNullable<T>, DocType, QueryHelpers>;
cache(ttl: number = 60, customKey: string = ''): this
cache(customKey: string = ''): this
cache(ttl: number = 60): this
}
}