Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
type ThinkCacheType = 'file' | 'redis';

interface ThinkCacheOptionRedis {
/**
* 缓存过期时间(毫秒)
*/
timeout?: number;
}

interface ThinkCacheOption {
type?: ThinkCacheType;
/**
* 缓存过期时间(毫秒)
*/
timeout?: number;
redis?: ThinkCacheOptionRedis;
}

interface ThinkCacheCtx {
/**
* get cache
Expand All @@ -13,14 +31,14 @@ interface ThinkCacheCtx {
* else mean set cache
* @memberOf CacheExtend
*/
cache(name: string, value?: any, config?: object): Promise<any>;
cache(name: string, value?: any, config?: ThinkCacheType | ThinkCacheOption): Promise<any>;

/**
* get cache
*
* @memberOf CacheExtend
*/
cache(name: string, value: Function): Promise<any>;
cache(name: string, value: Promise<any>): Promise<any>;
}

declare module 'thinkjs' {
Expand Down