From 5af11cc200dd5ebe474b9c0475883b0e6d1e3759 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期三, 11 三月 2026 10:00:49 +0800
Subject: [PATCH] 重构整个项目:改进代码质量和架构

---
 Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Caches/MemoryCacheService.cs |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Caches/MemoryCacheService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Caches/MemoryCacheService.cs
index 60a2d72..c179eb5 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Caches/MemoryCacheService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_Core/Caches/MemoryCacheService.cs
@@ -9,11 +9,11 @@
 {
     public class MemoryCacheService : ICacheService
     {
-        protected IMemoryCache _cache;
+        private readonly IMemoryCache _cache;
+
         public MemoryCacheService(IMemoryCache cache)
         {
-            _cache = cache;
-
+            _cache = cache ?? throw new ArgumentNullException(nameof(cache));
         }
 
         public bool Add(string key, string value, int expireSeconds = -1, bool isSliding = false)
@@ -54,8 +54,7 @@
 
         public void Dispose()
         {
-            if (_cache != null)
-                _cache.Dispose();
+            _cache?.Dispose();
             GC.SuppressFinalize(this);
         }
 
@@ -68,7 +67,7 @@
             return _cache.Get(key) != null;
         }
 
-        public T Get<T>(string key) where T : class
+        public T? Get<T>(string key) where T : class
         {
             if (key == null)
             {

--
Gitblit v1.9.3