소스 검색

解决空值报错问题

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))
   })