Exemplo n.º 1
0
 public bool TryGet(string key, IRequestContext requestContext, out AnchorMailboxCacheEntry entry)
 {
     PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxLocalCacheHitsRateBase.Increment();
     PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxOverallCacheHitsRateBase.Increment();
     entry = null;
     if (this.innerCache.TryGetValue(key, out entry))
     {
         PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxLocalCacheHitsRate.Increment();
     }
     else if (HttpProxySettings.AnchorMailboxSharedCacheEnabled.Value)
     {
         long   latency  = 0L;
         string diagInfo = null;
         AnchorMailboxCacheEntry sharedCacheEntry = null;
         bool latency2 = LatencyTracker.GetLatency <bool>(() => this.sharedCacheClient.TryGet <AnchorMailboxCacheEntry>(key, requestContext.ActivityId, out sharedCacheEntry, out diagInfo), out latency);
         requestContext.LogSharedCacheCall(latency, diagInfo);
         if (latency2)
         {
             this.Add(key, sharedCacheEntry, requestContext, false);
             entry = sharedCacheEntry;
         }
     }
     if (entry != null)
     {
         PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxOverallCacheHitsRate.Increment();
         return(true);
     }
     return(false);
 }
Exemplo n.º 2
0
 protected override void OnPopulateCacheEntry(AnchorMailboxCacheEntry cacheEntry)
 {
     if (PuidAnchorMailbox.AllowMissingDirectoryObject.Value && cacheEntry != null && !string.IsNullOrEmpty(cacheEntry.DomainName))
     {
         base.RequestContext.HttpContext.Items[Constants.OrganizationContextKey] = cacheEntry.DomainName;
     }
 }
Exemplo n.º 3
0
 // Token: 0x06000216 RID: 534 RVA: 0x0000A7F8 File Offset: 0x000089F8
 public bool TryGet(string key, IRequestContext requestContext, out AnchorMailboxCacheEntry entry)
 {
     PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxLocalCacheHitsRateBase.Increment();
     PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxOverallCacheHitsRateBase.Increment();
     entry = null;
     if (key == null)
     {
         throw new ArgumentNullException("key");
     }
     if (this.TryGetFromInMemoryCache(key, out entry))
     {
         PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxLocalCacheHitsRate.Increment();
     }
     else
     {
         SharedCacheDiagnostics sharedCacheDiagnostics;
         bool flag = this.TryGetFromSharedCache(key, out entry, out sharedCacheDiagnostics);
         AnchorMailboxCache.LogSharedCacheDiagnostics(requestContext, sharedCacheDiagnostics);
         if (flag && this.TryAddToInMemoryCache(key, entry))
         {
             this.UpdateInMemoryCacheSizeCounter();
         }
     }
     if (entry != null)
     {
         PerfCounters.HttpProxyCacheCountersInstance.AnchorMailboxOverallCacheHitsRate.Increment();
         return(true);
     }
     return(false);
 }
Exemplo n.º 4
0
        public void UpdateCache(AnchorMailboxCacheEntry cacheEntry)
        {
            string key = this.ToCacheKey();

            AnchorMailboxCache.Instance.Add(key, cacheEntry, this.RequestContext);
            if (HttpProxySettings.NegativeAnchorMailboxCacheEnabled.Value)
            {
                NegativeAnchorMailboxCache.Instance.Remove(key);
            }
        }
Exemplo n.º 5
0
 public void Add(string key, AnchorMailboxCacheEntry entry, DateTime valueTimestamp, IRequestContext requestContext, bool addToSharedCache)
 {
     this.innerCache.TryInsertLimitedSliding(key, entry, AnchorMailboxCache.AnchorMailboxCacheAbsoluteTimeout, AnchorMailboxCache.AnchorMailboxCacheSlidingTimeout);
     if (HttpProxySettings.AnchorMailboxSharedCacheEnabled.Value && addToSharedCache)
     {
         long   latency  = 0L;
         string diagInfo = null;
         LatencyTracker.GetLatency <bool>(() => this.sharedCacheClient.TryInsert(key, entry, valueTimestamp, requestContext.ActivityId, out diagInfo), out latency);
         requestContext.LogSharedCacheCall(latency, diagInfo);
     }
     this.UpdateCacheSizeCounter();
 }
Exemplo n.º 6
0
        // Token: 0x060000D2 RID: 210 RVA: 0x00005200 File Offset: 0x00003400
        public void UpdateCache(AnchorMailboxCacheEntry cacheEntry)
        {
            string text = this.ToCacheKey();

            if (text != null && cacheEntry != null)
            {
                if (cacheEntry.Database != null)
                {
                    AnchorMailboxCache.Instance.Add(text, cacheEntry, DateTime.UtcNow, this.RequestContext);
                }
                if (HttpProxySettings.NegativeAnchorMailboxCacheEnabled.Value)
                {
                    NegativeAnchorMailboxCache.Instance.Remove(text);
                }
            }
        }
        public override bool Equals(object obj)
        {
            AnchorMailboxCacheEntry anchorMailboxCacheEntry = obj as AnchorMailboxCacheEntry;

            if (anchorMailboxCacheEntry != null && ((string.IsNullOrEmpty(this.DomainName) && string.IsNullOrEmpty(anchorMailboxCacheEntry.DomainName)) || string.Equals(this.DomainName, anchorMailboxCacheEntry.DomainName)))
            {
                if (this.Database == null)
                {
                    return(anchorMailboxCacheEntry.Database == null);
                }
                if (anchorMailboxCacheEntry.Database != null && this.Database.ObjectGuid == anchorMailboxCacheEntry.Database.ObjectGuid)
                {
                    return((string.IsNullOrEmpty(this.Database.PartitionFQDN) && string.IsNullOrEmpty(anchorMailboxCacheEntry.Database.PartitionFQDN)) || string.Equals(this.Database.PartitionFQDN, anchorMailboxCacheEntry.Database.PartitionFQDN));
                }
            }
            return(false);
        }
Exemplo n.º 8
0
        // Token: 0x06000217 RID: 535 RVA: 0x0000A890 File Offset: 0x00008A90
        public void Add(string key, AnchorMailboxCacheEntry entry, DateTime valueTimestamp, IRequestContext requestContext)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            if (this.TryAddToInMemoryCache(key, entry))
            {
                this.UpdateInMemoryCacheSizeCounter();
            }
            SharedCacheDiagnostics sharedCacheDiagnostics;

            this.TryAddToSharedCache(key, entry, valueTimestamp, out sharedCacheDiagnostics);
            AnchorMailboxCache.LogSharedCacheDiagnostics(requestContext, sharedCacheDiagnostics);
        }
Exemplo n.º 9
0
 // Token: 0x060000D8 RID: 216 RVA: 0x00003193 File Offset: 0x00001393
 protected virtual bool ShouldAddEntryToAnchorMailboxCache(AnchorMailboxCacheEntry cacheEntry)
 {
     return(true);
 }
Exemplo n.º 10
0
 public void Add(string key, AnchorMailboxCacheEntry entry, IRequestContext requestContext)
 {
     this.Add(key, entry, requestContext, true);
 }
Exemplo n.º 11
0
 protected override bool ShouldAddEntryToAnchorMailboxCache(AnchorMailboxCacheEntry cacheEntry)
 {
     return(!PuidAnchorMailbox.AllowMissingDirectoryObject.Value || (cacheEntry != null && cacheEntry.Database != null));
 }
Exemplo n.º 12
0
 public void Add(string key, AnchorMailboxCacheEntry entry, IRequestContext requestContext, bool addToSharedCache)
 {
     this.Add(key, entry, DateTime.UtcNow, requestContext, addToSharedCache);
 }
Exemplo n.º 13
0
 protected virtual void OnPopulateCacheEntry(AnchorMailboxCacheEntry cacheEntry)
 {
 }
Exemplo n.º 14
0
 // Token: 0x06000220 RID: 544 RVA: 0x0000AA31 File Offset: 0x00008C31
 private bool TryGetFromSharedCache(string key, out AnchorMailboxCacheEntry entry, out SharedCacheDiagnostics sharedCacheDiagnostics)
 {
     entry = null;
     sharedCacheDiagnostics = null;
     return(HttpProxySettings.AnchorMailboxSharedCacheEnabled.Value && this.sharedCacheClient.TryGet <AnchorMailboxCacheEntry>(key, ref entry, ref sharedCacheDiagnostics));
 }
Exemplo n.º 15
0
 // Token: 0x0600021F RID: 543 RVA: 0x0000AA11 File Offset: 0x00008C11
 private bool TryGetFromInMemoryCache(string key, out AnchorMailboxCacheEntry entry)
 {
     entry = null;
     return(AnchorMailboxCache.InMemoryCacheEnabled.Value && this.inMemoryCache.TryGet(key, ref entry));
 }
Exemplo n.º 16
0
 // Token: 0x0600021C RID: 540 RVA: 0x0000A99D File Offset: 0x00008B9D
 private bool TryAddToSharedCache(string key, AnchorMailboxCacheEntry entry, DateTime valueTimestamp, out SharedCacheDiagnostics sharedCacheDiagnostics)
 {
     sharedCacheDiagnostics = null;
     return(HttpProxySettings.AnchorMailboxSharedCacheEnabled.Value && this.sharedCacheClient.TryInsert(key, entry, valueTimestamp.Ticks, ref sharedCacheDiagnostics));
 }
Exemplo n.º 17
0
 // Token: 0x0600021B RID: 539 RVA: 0x0000A980 File Offset: 0x00008B80
 private bool TryAddToInMemoryCache(string key, AnchorMailboxCacheEntry entry)
 {
     return(AnchorMailboxCache.InMemoryCacheEnabled.Value && this.inMemoryCache.TryAddOrUpdate(key, entry));
 }