mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-09-19 18:22:23 +08:00
Rename
This commit is contained in:
@@ -265,7 +265,7 @@ namespace SqlSugar
|
|||||||
#region Cache
|
#region Cache
|
||||||
public ICacheManager<T> GetCacheInstance<T>()
|
public ICacheManager<T> GetCacheInstance<T>()
|
||||||
{
|
{
|
||||||
return CacheManager<T>.GetInstance();
|
return RefractionInoCache<T>.GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveCacheAll()
|
public void RemoveCacheAll()
|
||||||
@@ -275,12 +275,12 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public void RemoveCacheAll<T>()
|
public void RemoveCacheAll<T>()
|
||||||
{
|
{
|
||||||
CacheManager<T>.GetInstance().RemoveAllCache();
|
RefractionInoCache<T>.GetInstance().RemoveAllCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveCache<T>(string key)
|
public void RemoveCache<T>(string key)
|
||||||
{
|
{
|
||||||
CacheManager<T>.GetInstance().Remove(key);
|
RefractionInoCache<T>.GetInstance().Remove(key);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@@ -6,12 +6,12 @@ using System.Collections;
|
|||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
namespace SqlSugar
|
namespace SqlSugar
|
||||||
{
|
{
|
||||||
public class CacheManager<V> : ICacheManager<V>
|
public class RefractionInoCache<V> : ICacheManager<V>
|
||||||
{
|
{
|
||||||
readonly System.Collections.Concurrent.ConcurrentDictionary<string, V> InstanceCache = new System.Collections.Concurrent.ConcurrentDictionary<string, V>();
|
readonly System.Collections.Concurrent.ConcurrentDictionary<string, V> InstanceCache = new System.Collections.Concurrent.ConcurrentDictionary<string, V>();
|
||||||
private static CacheManager<V> _instance = null;
|
private static RefractionInoCache<V> _instance = null;
|
||||||
private static readonly object _instanceLock = new object();
|
private static readonly object _instanceLock = new object();
|
||||||
private CacheManager() { }
|
private RefractionInoCache() { }
|
||||||
|
|
||||||
public V this[string key]
|
public V this[string key]
|
||||||
{
|
{
|
||||||
@@ -34,14 +34,14 @@ namespace SqlSugar
|
|||||||
return default(V);
|
return default(V);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CacheManager<V> GetInstance()
|
public static RefractionInoCache<V> GetInstance()
|
||||||
{
|
{
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
lock (_instanceLock)
|
lock (_instanceLock)
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
{
|
{
|
||||||
_instance = new CacheManager<V>();
|
_instance = new RefractionInoCache<V>();
|
||||||
Action addItem =()=> { CacheManager<V>.GetInstance().RemoveAllCache(); };
|
Action addItem =()=> { RefractionInoCache<V>.GetInstance().RemoveAllCache(); };
|
||||||
CacheManager.Add(addItem);
|
CacheManager.Add(addItem);
|
||||||
}
|
}
|
||||||
return _instance;
|
return _instance;
|
||||||
@@ -78,7 +78,7 @@ namespace SqlSugar
|
|||||||
|
|
||||||
public V GetOrCreate(string cacheKey, Func<ICacheManager<V>, string, V> successAction, Func<ICacheManager<V>, string, V> errorAction)
|
public V GetOrCreate(string cacheKey, Func<ICacheManager<V>, string, V> successAction, Func<ICacheManager<V>, string, V> errorAction)
|
||||||
{
|
{
|
||||||
var cm = CacheManager<V>.GetInstance();
|
var cm = RefractionInoCache<V>.GetInstance();
|
||||||
if (cm.ContainsKey(cacheKey)) return successAction(cm, cacheKey);
|
if (cm.ContainsKey(cacheKey)) return successAction(cm, cacheKey);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user