From bfd4fd8e4a05a681ec10a47992294cf752a764c4 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 02 三月 2026 15:10:58 +0800
Subject: [PATCH] 添加Redis服务与缓存增强
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs
index fc0cd5b..4b08204 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Http/HTTP/HttpClientHelper.cs
@@ -10,16 +10,19 @@
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
+using WIDESEAWCS_Core.Caches;
namespace WIDESEA_Core
{
public class HttpClientHelper
{
private readonly IHttpClientFactory _httpClientFactory;
+ private readonly ICacheService _cache;
- public HttpClientHelper(IHttpClientFactory httpClientFactory, IConfiguration configuration = null)
+ public HttpClientHelper(IHttpClientFactory httpClientFactory, ICacheService cache, IConfiguration configuration = null)
{
_httpClientFactory = httpClientFactory ?? throw new ArgumentNullException(nameof(httpClientFactory));
+ _cache = cache ?? throw new ArgumentNullException(nameof(cache));
}
/// <summary>
@@ -32,6 +35,7 @@
/// <returns></returns>
public HttpResponseResult Post(string url, string content, string contentType = "application/json", HttpRequestConfig? config = null)
{
+ url = _cache.Get(url);
HttpResponseResult httpResponseResult = ExecuteAsync(async (client) =>
{
var request = new HttpRequestMessage(HttpMethod.Post, url);
--
Gitblit v1.9.3