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