修复缓存相关问题

This commit is contained in:
白茶清欢 2024-06-14 22:48:32 +08:00
parent a21eb17f5f
commit c50cb0039a

View File

@ -376,9 +376,11 @@ func (hc *HttpClient) setCacheResult(response *define.Response) (bool, error) {
return false, nil
}
cacheKey := hc.cacheInstance.GetKey(hc.reqConfig)
if err := hc.cacheInstance.SetValue(response.CacheInfo.CacheKey, serialize.JSON.MarshalForString(response)); nil != err {
cacheValue := serialize.JSON.MarshalForString(response)
if err := hc.cacheInstance.SetValue(cacheKey, cacheValue); nil != err {
return false, err
}
response.CacheInfo.CacheKey = cacheKey
response.CacheInfo.CacheValue = cacheValue
return true, nil
}