ソースを参照

解决空值报错问题

zhusiqing 4 年 前
コミット
a3e53be1e8
1 ファイル変更1 行追加1 行削除
  1. 1 1
      src/middlewares/redis.ts

+ 1 - 1
src/middlewares/redis.ts

@@ -62,7 +62,7 @@ const setClient = promisify(client.set).bind(client);
 const setexClient = promisify(client.setex).bind(client);
 
 // 内存存储promise化,为了和redis使用方法保持一致
-const getCache = (key: string): Promise<string> => {
+const getCache = (key: string): Promise<string|undefined> => {
   return new Promise(resolve => {
     resolve(cache.get(key))
   })