mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2026-02-27 16:50:33 +08:00
Add Remove Cache All
This commit is contained in:
@@ -39,7 +39,10 @@ namespace SqlSugar
|
|||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
lock (_instanceLock)
|
lock (_instanceLock)
|
||||||
if (_instance == null)
|
if (_instance == null)
|
||||||
|
{
|
||||||
_instance = new CacheManager<V>();
|
_instance = new CacheManager<V>();
|
||||||
|
CacheManager.Add(_instance.InstanceCache);
|
||||||
|
}
|
||||||
return _instance;
|
return _instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,4 +87,23 @@ namespace SqlSugar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static class CacheManager
|
||||||
|
{
|
||||||
|
private static List<object> CacheObjects = new List<object>();
|
||||||
|
internal static void Add(object CacheObject)
|
||||||
|
{
|
||||||
|
CacheObjects.Add(CacheObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RemoveAllCache()
|
||||||
|
{
|
||||||
|
lock (CacheObjects)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < CacheObjects.Count; i++)
|
||||||
|
{
|
||||||
|
CacheObjects[i] = Activator.CreateInstance(CacheObjects[i].GetType(), true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user