protected override int GetCurrentPressure()
        {
            int  num  = GC.CollectionCount(2);
            SRef ref2 = this._sizedRef;

            if ((num != this._gen2Count) && (ref2 != null))
            {
                this._gen2Count = num;
                this._idx      ^= 1;
                this._cacheSizeSampleTimes[this._idx] = DateTime.UtcNow;
                this._cacheSizeSamples[this._idx]     = ref2.ApproximateSize;
                ApplicationManager applicationManager = HostingEnvironment.GetApplicationManager();
                if (applicationManager != null)
                {
                    long sizeUpdate = this._cacheSizeSamples[this._idx] - this._cacheSizeSamples[this._idx ^ 1];
                    this._totalCacheSize = applicationManager.GetUpdatedTotalCacheSize(sizeUpdate);
                }
                else
                {
                    this._totalCacheSize = this._cacheSizeSamples[this._idx];
                }
            }
            if (this._memoryLimit <= 0L)
            {
                return(0);
            }
            long num3 = this._cacheSizeSamples[this._idx];

            if (num3 > this._memoryLimit)
            {
                num3 = this._memoryLimit;
            }
            PerfCounters.SetCounter(AppPerfCounter.CACHE_PERCENT_PROC_MEM_LIMIT_USED, (int)(num3 >> 10));
            return((int)((num3 * 100L) / this._memoryLimit));
        }
 internal CacheMemorySizePressure(SRef sizedRef)
 {
     this._sizedRef             = sizedRef;
     this._gen2Count            = GC.CollectionCount(2);
     this._cacheSizeSamples     = new long[2];
     this._cacheSizeSampleTimes = new DateTime[2];
     base._pressureHigh         = 0x63;
     base._pressureMiddle       = 0x62;
     base._pressureLow          = 0x61;
     this._startupTime          = DateTime.UtcNow;
     base.InitHistory();
 }
 internal CacheMemorySizePressure(SRef sizedRef)
 {
     this._sizedRef = sizedRef;
     this._gen2Count = GC.CollectionCount(2);
     this._cacheSizeSamples = new long[2];
     this._cacheSizeSampleTimes = new DateTime[2];
     base._pressureHigh = 0x63;
     base._pressureMiddle = 0x62;
     base._pressureLow = 0x61;
     this._startupTime = DateTime.UtcNow;
     base.InitHistory();
 }
        internal void Dispose()
        {
            SRef comparand = this._sizedRef;

            if ((comparand != null) && (Interlocked.CompareExchange <SRef>(ref this._sizedRef, null, comparand) == comparand))
            {
                comparand.Dispose();
            }
            ApplicationManager applicationManager = HostingEnvironment.GetApplicationManager();

            if (applicationManager != null)
            {
                long sizeUpdate = -this._cacheSizeSamples[this._idx];
                applicationManager.GetUpdatedTotalCacheSize(sizeUpdate);
            }
        }
 internal CacheMemoryStats(SRef sizedRef)
 {
     this._pressureCacheSize = new CacheMemorySizePressure(sizedRef);
 }
 internal CacheMemoryStats(SRef sizedRef)
 {
     this._pressureCacheSize = new CacheMemorySizePressure(sizedRef);
 }