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