Faster method of moving objects from a temporary cache list to indexed cache lists
This commit is contained in:
@@ -66,20 +66,19 @@ namespace VEPROMS.CSLA.Library
|
||||
private static Dictionary<string, List<Figure>> _CacheByROFstID_ImageID = new Dictionary<string, List<Figure>>();
|
||||
private static void ConvertListToDictionary()
|
||||
{
|
||||
List<Figure> remove = new List<Figure>();
|
||||
foreach (Figure tmp in _CacheList)
|
||||
while (_CacheList.Count > 0) // Move Figure(s) from temporary _CacheList to _CacheByPrimaryKey
|
||||
{
|
||||
if (!_CacheByPrimaryKey.ContainsKey(tmp.FigureID.ToString()))
|
||||
Figure tmp = _CacheList[0]; // Get the first Figure
|
||||
string pKey = tmp.FigureID.ToString();
|
||||
if (!_CacheByPrimaryKey.ContainsKey(pKey))
|
||||
{
|
||||
_CacheByPrimaryKey[tmp.FigureID.ToString()] = new List<Figure>(); // Add new list for PrimaryKey
|
||||
_CacheByPrimaryKey[pKey] = new List<Figure>(); // Add new list for PrimaryKey
|
||||
_CacheByROFstID_ImageID[tmp.ROFstID.ToString() + "_" + tmp.ImageID.ToString()] = new List<Figure>(); // Add new list for ROFstID_ImageID
|
||||
}
|
||||
_CacheByPrimaryKey[tmp.FigureID.ToString()].Add(tmp); // Add to Primary Key list
|
||||
_CacheByPrimaryKey[pKey].Add(tmp); // Add to Primary Key list
|
||||
_CacheByROFstID_ImageID[tmp.ROFstID.ToString() + "_" + tmp.ImageID.ToString()].Add(tmp); // Unique Index
|
||||
remove.Add(tmp);
|
||||
_CacheList.RemoveAt(0); // Remove the first Figure
|
||||
}
|
||||
foreach (Figure tmp in remove)
|
||||
RemoveFromCache(tmp);
|
||||
}
|
||||
protected static Figure GetCachedByPrimaryKey(int figureID)
|
||||
{
|
||||
|
Reference in New Issue
Block a user