Example #1
0
 /// <summary>
 /// This method adds an entry to the cache, without taking a lock
 /// </summary>
 private void AddCacheEntryInternal(CacheEntry cacheEntry)
 {
     if (!cacheContents.ContainsKey(cacheEntry.Name))
     {
         cacheContents.Add(cacheEntry.Name, cacheEntry);
     }
     else
     {
         CacheEntry existingCacheEntry = (CacheEntry)cacheContents[cacheEntry.Name];
         // Make sure the cache values, if overwritten, stay the same. We do not currently support
         // changing the cached value to something else. This allows us to not have a notification
         // mechanism for changed values and if a node has a cached entry it can assume it's up to date.
         // This can change in the future if we discover a compelling scenario for changing cache values.
         if (!cacheEntry.IsEquivalent(existingCacheEntry))
         {
             ErrorUtilities.VerifyThrowInvalidOperation(false, "CannotModifyCacheEntryValues");
         }
     }
 }
Example #2
0
 /// <summary>
 /// This method adds an entry to the cache, without taking a lock
 /// </summary>
 private void AddCacheEntryInternal(CacheEntry cacheEntry)
 {
     if (!cacheContents.ContainsKey(cacheEntry.Name))
     {
         cacheContents.Add(cacheEntry.Name, cacheEntry);
     }
     else
     {
         CacheEntry existingCacheEntry = (CacheEntry)cacheContents[cacheEntry.Name];
         // Make sure the cache values, if overwritten, stay the same. We do not currently support
         // changing the cached value to something else. This allows us to not have a notification
         // mechanism for changed values and if a node has a cached entry it can assume it's up to date.
         // This can change in the future if we discover a compelling scenario for changing cache values.
         if (!cacheEntry.IsEquivalent(existingCacheEntry))
         {
             ErrorUtilities.VerifyThrowInvalidOperation(false, "CannotModifyCacheEntryValues");
         }
     }
 }