private void StartMonitoring(MemoryCache cache, MemoryCacheEntry entry, ref bool hasChanged, ref DateTime utcCreated) { if (entry != null) { // pass reference to self so the dependency can notify us when it changes entry.AddDependent(cache, this); // add dependency to collection so we can dispose it later _dependencies.Add(entry); // has the entry already changed? if (entry.State != EntryState.AddedToCache) { hasChanged = true; } utcCreated = entry.UtcCreated; } else { // the entry does not exist--set hasChanged to true so the user is notified hasChanged = true; } }
private void StartMonitoring(MemoryCache cache, MemoryCacheEntry entry, ref bool hasChanged, ref DateTime utcCreated) { if (entry != null) { entry.AddDependent(cache, this); this._dependencies.Add(entry); if (entry.State != EntryState.AddedToCache) { hasChanged = true; } utcCreated = entry.UtcCreated; } else { hasChanged = true; } }