forked from aalfiann/recachegoose
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
26 lines (20 loc) · 947 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
//Adopted from on https://github.com/xrip/cachegoose
import { RedisOptions } from 'ioredis';
import { Document, Mongoose } from 'mongoose';
declare module 'recachegoose-ioredis' {
function cachegoose(mongoose: Mongoose, cacheOptions: RedisOptions): void;
namespace cachegoose {
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
}
}