Browse Source

解决空值报错问题

zhusiqing 4 năm trước cách đây
mục cha
commit
a3e53be1e8
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  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))
   })