(converseId: string, refetch = false)
| 94 | * 获取缓存的用户信息 |
| 95 | */ |
| 96 | export async function getCachedAckInfo(converseId: string, refetch = false) { |
| 97 | const data = await queryClient.fetchQuery( |
| 98 | [CacheKey.converseAck, converseId], |
| 99 | () => { |
| 100 | return Promise.all([ |
| 101 | getConverseAckInfo([converseId]).then((d) => d[0]), |
| 102 | getConverseLastMessageInfo([converseId]).then((d) => d[0]), |
| 103 | ]).then(([ack, lastMessage]) => { |
| 104 | return { |
| 105 | converseId, |
| 106 | ack, |
| 107 | lastMessage, |
| 108 | }; |
| 109 | }); |
| 110 | }, |
| 111 | { |
| 112 | staleTime: 2 * 1000, // 缓存2s, 减少一秒内的重复请求(无意义) |
| 113 | } |
| 114 | ); |
| 115 | |
| 116 | return data; |
| 117 | } |
| 118 | |
| 119 | /** |
| 120 | * 获取缓存的插件列表 |
no test coverage detected