예제 #1
0
 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);
                 }
             }
         }
     }
 }
 internal MemoryCacheStore(MemoryCache cache, PerfCounters perfCounters) {
     _cache = cache;
     _perfCounters = perfCounters;
     _entries = new Hashtable(new MemoryCacheEqualityComparer());
     _entriesLock = new Object();
     _expires = new CacheExpires(this);
     _usage = new CacheUsage(this);
     InitDisposableMembers();
 }
예제 #3
0
 internal MemoryCacheStore(MemoryCache cache, PerfCounters perfCounters)
 {
     _cache        = cache;
     _perfCounters = perfCounters;
     _entries      = new Hashtable(new MemoryCacheEqualityComparer());
     _entriesLock  = new Object();
     _expires      = new CacheExpires(this);
     _usage        = new CacheUsage(this);
     InitDisposableMembers();
 }
예제 #4
0
 internal void UpdateUsage(DateTime utcNow, CacheUsage usage)
 {
     if (this.InUsage() && (this._utcLastUpdateUsage < (utcNow - CacheUsage.CORRELATED_REQUEST_TIMEOUT)))
     {
         this._utcLastUpdateUsage = utcNow;
         usage.Update(this);
         if ((this._fields != null) && (this._fields._dependencies != null))
         {
             foreach (ChangeMonitor monitor in this._fields._dependencies)
             {
                 MemoryCacheEntryChangeMonitor monitor2 = monitor as MemoryCacheEntryChangeMonitor;
                 if (monitor2 != null)
                 {
                     foreach (MemoryCacheEntry entry in monitor2.Dependencies)
                     {
                         MemoryCacheStore store = entry._fields._cache.GetStore(entry);
                         entry.UpdateUsage(utcNow, store.Usage);
                     }
                 }
             }
         }
     }
 }
 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);
                 }
             }
         }
     }
 }
 internal UsageBucket(CacheUsage cacheUsage, byte bucket)
 {
     this._cacheUsage = cacheUsage;
     this._bucket = bucket;
     this.InitZeroPages();
 }
 internal UsageBucket(CacheUsage cacheUsage, byte bucket)
 {
     this._cacheUsage = cacheUsage;
     this._bucket     = bucket;
     this.InitZeroPages();
 }
예제 #8
0
 internal UsageBucket(CacheUsage cacheUsage, byte bucket)
 {
     _cacheUsage = cacheUsage;
     _bucket     = bucket;
     InitZeroPages();
 }
 internal void UpdateUsage(DateTime utcNow, CacheUsage usage)
 {
     if (this.InUsage() && (this._utcLastUpdateUsage < (utcNow - CacheUsage.CORRELATED_REQUEST_TIMEOUT)))
     {
         this._utcLastUpdateUsage = utcNow;
         usage.Update(this);
         if ((this._fields != null) && (this._fields._dependencies != null))
         {
             foreach (ChangeMonitor monitor in this._fields._dependencies)
             {
                 MemoryCacheEntryChangeMonitor monitor2 = monitor as MemoryCacheEntryChangeMonitor;
                 if (monitor2 != null)
                 {
                     foreach (MemoryCacheEntry entry in monitor2.Dependencies)
                     {
                         MemoryCacheStore store = entry._fields._cache.GetStore(entry);
                         entry.UpdateUsage(utcNow, store.Usage);
                     }
                 }
             }
         }
     }
 }