internal void UpdateUsage(DateTime utcNow, CacheUsage usage)
{
// update, but not more frequently than once per second.
if (InUsage() && _utcLastUpdateUsage < utcNow - CacheUsage.CORRELATED_REQUEST_TIMEOUT)
{
_utcLastUpdateUsage = utcNow;
usage.Update(this);
if (_fields != null && _fields._dependencies != null)
{
foreach (ChangeMonitor monitor in _fields._dependencies)
{
MemoryCacheEntryChangeMonitor m = monitor as MemoryCacheEntryChangeMonitor;
if (m == null)
{
continue;
}
foreach (MemoryCacheEntry e in m.Dependencies)
{
MemoryCacheStore store = e._fields._cache.GetStore(e);
e.UpdateUsage(utcNow, store.Usage);
}
}
}
}
}