diff --git a/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs b/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs index 1915734cb..8d00c4179 100644 --- a/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs +++ b/Src/Asp.Net/SqlSugar/Infrastructure/ContextMethods.cs @@ -271,17 +271,17 @@ namespace SqlSugar public void RemoveCacheAll() { - CacheHelper.RemoveAllCache(); + ReflectionInoHelper.RemoveAllCache(); } public void RemoveCacheAll() { - ReflectionInoCacheHelper.GetInstance().RemoveAllCache(); + ReflectionInoCore.GetInstance().RemoveAllCache(); } public void RemoveCache(string key) { - ReflectionInoCacheHelper.GetInstance().Remove(key); + ReflectionInoCore.GetInstance().Remove(key); } #endregion diff --git a/Src/Asp.Net/SqlSugar/IntegrationServices/CacheService.cs b/Src/Asp.Net/SqlSugar/IntegrationServices/CacheService.cs index f83da10c4..9bf9d43d0 100644 --- a/Src/Asp.Net/SqlSugar/IntegrationServices/CacheService.cs +++ b/Src/Asp.Net/SqlSugar/IntegrationServices/CacheService.cs @@ -10,44 +10,44 @@ namespace SqlSugar { public void Add(string key, V value) { - ReflectionInoCacheHelper.GetInstance().Add(key,value); + ReflectionInoCore.GetInstance().Add(key,value); } public void Add(string key, V value, int cacheDurationInSeconds) { - ReflectionInoCacheHelper.GetInstance().Add(key, value,cacheDurationInSeconds); + ReflectionInoCore.GetInstance().Add(key, value,cacheDurationInSeconds); } public bool ContainsKey(string key) { - return ReflectionInoCacheHelper.GetInstance().ContainsKey(key); + return ReflectionInoCore.GetInstance().ContainsKey(key); } public V Get(string key) { - return ReflectionInoCacheHelper.GetInstance().Get(key); + return ReflectionInoCore.GetInstance().Get(key); } public IEnumerable GetAllKey() { - return ReflectionInoCacheHelper.GetInstance().GetAllKey(); + return ReflectionInoCore.GetInstance().GetAllKey(); } public V GetOrCreate(string cacheKey, Func create) { - return ReflectionInoCacheHelper.GetInstance().GetOrCreate(cacheKey, create); + return ReflectionInoCore.GetInstance().GetOrCreate(cacheKey, create); } public void Remove(string key) { - ReflectionInoCacheHelper.GetInstance().Remove(key); + ReflectionInoCore.GetInstance().Remove(key); } } - public class ReflectionInoCacheHelper + public class ReflectionInoCore { readonly System.Collections.Concurrent.ConcurrentDictionary InstanceCache = new System.Collections.Concurrent.ConcurrentDictionary(); - private static ReflectionInoCacheHelper _instance = null; + private static ReflectionInoCore _instance = null; private static readonly object _instanceLock = new object(); - private ReflectionInoCacheHelper() { } + private ReflectionInoCore() { } public V this[string key] { @@ -70,15 +70,15 @@ namespace SqlSugar return default(V); } - public static ReflectionInoCacheHelper GetInstance() + public static ReflectionInoCore GetInstance() { if (_instance == null) lock (_instanceLock) if (_instance == null) { - _instance = new ReflectionInoCacheHelper(); - Action addItem =()=> { ReflectionInoCacheHelper.GetInstance().RemoveAllCache(); }; - CacheHelper.AddRemoveFunc(addItem); + _instance = new ReflectionInoCore(); + Action addItem =()=> { ReflectionInoCore.GetInstance().RemoveAllCache(); }; + ReflectionInoHelper.AddRemoveFunc(addItem); } return _instance; } @@ -123,7 +123,7 @@ namespace SqlSugar } } } - internal static class CacheHelper + internal static class ReflectionInoHelper { private static List removeActions = new List(); internal static void AddRemoveFunc(Action removeAction)