Exemplo n.º 1
0
        // Token: 0x0600025B RID: 603 RVA: 0x0000BE40 File Offset: 0x0000A040
        public void Add(string key, NegativeAnchorMailboxCacheEntry entry)
        {
            TimeSpan timeSpan = this.cacheAbsoluteTimeout;
            NegativeAnchorMailboxCacheEntry negativeAnchorMailboxCacheEntry;

            if (!this.TryGet(key, false, out negativeAnchorMailboxCacheEntry))
            {
                entry.StartTime  = DateTime.UtcNow;
                entry.Generation = 1;
                this.Add(key, entry, timeSpan, true);
                return;
            }
            double num;

            NegativeAnchorMailboxCacheEntry.CacheGeneration generation;
            if (!this.IsDueForRefresh(negativeAnchorMailboxCacheEntry, out num, out generation))
            {
                return;
            }
            if (timeSpan.TotalSeconds > num)
            {
                negativeAnchorMailboxCacheEntry.Generation = generation;
                this.Add(key, negativeAnchorMailboxCacheEntry, timeSpan - TimeSpan.FromSeconds(num), false);
            }
        }
Exemplo n.º 2
0
 // Token: 0x06000260 RID: 608 RVA: 0x0000BFAD File Offset: 0x0000A1AD
 private void Add(string key, NegativeAnchorMailboxCacheEntry entry, TimeSpan timeout, bool updatePerfCounter)
 {
     this.innerCache.TryInsertAbsolute(key, entry, timeout);
     if (updatePerfCounter)
     {
         this.UpdateCacheSizeCounter();
     }
 }
Exemplo n.º 3
0
 // Token: 0x0600025F RID: 607 RVA: 0x0000BF83 File Offset: 0x0000A183
 private bool TryGet(string key, bool updatePerfCounter, out NegativeAnchorMailboxCacheEntry entry)
 {
     if (updatePerfCounter)
     {
         PerfCounters.HttpProxyCacheCountersInstance.NegativeAnchorMailboxLocalCacheHitsRateBase.Increment();
     }
     entry = null;
     return(this.innerCache.TryGetValue(key, ref entry));
 }
Exemplo n.º 4
0
        // Token: 0x060000D4 RID: 212 RVA: 0x00005294 File Offset: 0x00003494
        public void UpdateNegativeCache(NegativeAnchorMailboxCacheEntry cacheEntry)
        {
            if (!HttpProxySettings.NegativeAnchorMailboxCacheEnabled.Value)
            {
                return;
            }
            string key = this.ToCacheKey();

            NegativeAnchorMailboxCache.Instance.Add(key, cacheEntry);
            AnchorMailboxCache.Instance.Remove(key, this.RequestContext);
        }
Exemplo n.º 5
0
        // Token: 0x0600025C RID: 604 RVA: 0x0000BEB4 File Offset: 0x0000A0B4
        public bool TryGet(string key, out NegativeAnchorMailboxCacheEntry entry)
        {
            if (!this.TryGet(key, true, out entry))
            {
                return(false);
            }
            double num;

            NegativeAnchorMailboxCacheEntry.CacheGeneration cacheGeneration;
            if (this.IsDueForRefresh(entry, out num, out cacheGeneration))
            {
                return(false);
            }
            PerfCounters.HttpProxyCacheCountersInstance.NegativeAnchorMailboxLocalCacheHitsRate.Increment();
            return(true);
        }
Exemplo n.º 6
0
 // Token: 0x0600025E RID: 606 RVA: 0x0000BF00 File Offset: 0x0000A100
 private bool IsDueForRefresh(NegativeAnchorMailboxCacheEntry entry, out double timeElapsedInSeconds, out NegativeAnchorMailboxCacheEntry.CacheGeneration nextGeneration)
 {
     timeElapsedInSeconds = 0.0;
     nextGeneration       = (short)65535;
     if (entry.Generation == 65535)
     {
         return(false);
     }
     timeElapsedInSeconds = (DateTime.UtcNow - entry.StartTime).TotalSeconds;
     if (timeElapsedInSeconds > this.gen2Timeout.TotalSeconds)
     {
         nextGeneration = (short)65535;
         return(true);
     }
     if (timeElapsedInSeconds > this.gen1Timeout.TotalSeconds)
     {
         nextGeneration = 2;
         return(entry.Generation == 1);
     }
     return(false);
 }
        public override bool Equals(object obj)
        {
            NegativeAnchorMailboxCacheEntry negativeAnchorMailboxCacheEntry = obj as NegativeAnchorMailboxCacheEntry;

            return(negativeAnchorMailboxCacheEntry != null && this.Generation == negativeAnchorMailboxCacheEntry.Generation && this.ErrorCode == negativeAnchorMailboxCacheEntry.ErrorCode && this.SubErrorCode == negativeAnchorMailboxCacheEntry.SubErrorCode && this.StartTime == negativeAnchorMailboxCacheEntry.StartTime && ((string.IsNullOrEmpty(this.SourceObject) && string.IsNullOrEmpty(negativeAnchorMailboxCacheEntry.SourceObject)) || string.Equals(this.SourceObject, negativeAnchorMailboxCacheEntry.SourceObject)));
        }