From 8954a654ace427930593a141eb44e4b75d09c487 Mon Sep 17 00:00:00 2001 From: Charmtiger Date: Thu, 19 Mar 2020 18:15:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9cache=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B=E5=AE=9A=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 先改一下常用的,只能从文档上看出来,最好再细化一下。 --- index.d.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/index.d.ts b/index.d.ts index cb46bca..bca0a94 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,3 +1,21 @@ +type ThinkCacheType = 'file' | 'redis'; + +interface ThinkCacheOptionRedis { + /** + * 缓存过期时间(毫秒) + */ + timeout?: number; +} + +interface ThinkCacheOption { + type?: ThinkCacheType; + /** + * 缓存过期时间(毫秒) + */ + timeout?: number; + redis?: ThinkCacheOptionRedis; +} + interface ThinkCacheCtx { /** * get cache @@ -13,14 +31,14 @@ interface ThinkCacheCtx { * else mean set cache * @memberOf CacheExtend */ - cache(name: string, value?: any, config?: object): Promise; + cache(name: string, value?: any, config?: ThinkCacheType | ThinkCacheOption): Promise; /** * get cache * * @memberOf CacheExtend */ - cache(name: string, value: Function): Promise; + cache(name: string, value: Promise): Promise; } declare module 'thinkjs' {