コード例 #1
0
        // Token: 0x06000234 RID: 564 RVA: 0x0000AEE8 File Offset: 0x000090E8
        public bool TryGet(Guid database, IRequestContext requestContext, out MailboxServerCacheEntry cacheEntry)
        {
            cacheEntry = null;
            PerfCounters.HttpProxyCacheCountersInstance.BackEndServerLocalCacheHitsRateBase.Increment();
            PerfCounters.HttpProxyCacheCountersInstance.BackEndServerOverallCacheHitsRateBase.Increment();
            PerfCounters.IncrementMovingPercentagePerformanceCounterBase(PerfCounters.HttpProxyCacheCountersInstance.MovingPercentageBackEndServerLocalCacheHitsRate);
            PerfCounters.IncrementMovingPercentagePerformanceCounterBase(PerfCounters.HttpProxyCacheCountersInstance.MovingPercentageBackEndServerOverallCacheHitsRate);
            string key  = database.ToString();
            bool   flag = this.TryGetFromInMemoryCache(key, out cacheEntry);

            if (flag)
            {
                if (MailboxServerCache.IsE14ServerStale(cacheEntry))
                {
                    this.Remove(database, requestContext);
                    return(false);
                }
                PerfCounters.HttpProxyCacheCountersInstance.BackEndServerLocalCacheHitsRate.Increment();
                PerfCounters.UpdateMovingPercentagePerformanceCounter(PerfCounters.HttpProxyCacheCountersInstance.MovingPercentageBackEndServerLocalCacheHitsRate);
            }
            else
            {
                SharedCacheDiagnostics sharedCacheDiagnostics = null;
                flag = this.TryGetFromSharedCache(key, out cacheEntry, out sharedCacheDiagnostics);
                MailboxServerCache.LogSharedCacheDiagnostics(requestContext, sharedCacheDiagnostics);
                if (flag && this.TryAddToInMemoryCache(key, cacheEntry))
                {
                    this.UpdateInMemoryCacheSizeCounter();
                }
            }
            if (flag)
            {
                PerfCounters.HttpProxyCacheCountersInstance.BackEndServerOverallCacheHitsRate.Increment();
                PerfCounters.UpdateMovingPercentagePerformanceCounter(PerfCounters.HttpProxyCacheCountersInstance.MovingPercentageBackEndServerOverallCacheHitsRate);
                if (MailboxServerCache.InMemoryCacheEnabled.Value && MailboxServerCache.InternalRefreshEnabled.Value && cacheEntry.IsDueForRefresh(MailboxServerCache.GetRefreshInterval(cacheEntry.BackEndServer)))
                {
                    this.RegisterRefresh(new DatabaseWithForest(database, cacheEntry.ResourceForest, requestContext.ActivityId));
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(requestContext.Logger, "ServerLocatorRefresh", database);

                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(requestContext.Logger, "RefreshingCacheEntry", cacheEntry.ToString());
                }
            }
            return(flag);
        }
コード例 #2
0
        // Token: 0x06000237 RID: 567 RVA: 0x0000B090 File Offset: 0x00009290
        public void Remove(Guid database, IRequestContext requestContext)
        {
            string key = database.ToString();

            if (this.TryRemoveFromInMemoryCache(key))
            {
                this.UpdateInMemoryCacheSizeCounter();
            }
            SharedCacheDiagnostics sharedCacheDiagnostics;

            if (this.TryRemoveFromSharedCache(key, out sharedCacheDiagnostics))
            {
                RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(requestContext.Logger, "SharedCache", "MailboxServerCacheEntryRemovalSuccess");
            }
            else
            {
                RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericError(requestContext.Logger, "SharedCache", "MailboxServerCacheEntryRemovalFailure");
            }
            MailboxServerCache.LogSharedCacheDiagnostics(requestContext, sharedCacheDiagnostics);
        }
コード例 #3
0
        // Token: 0x0600023F RID: 575 RVA: 0x0000B278 File Offset: 0x00009478
        private void Add(Guid database, MailboxServerCacheEntry entry, IRequestContext requestContext)
        {
            string text = database.ToString();

            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }
            if (ExTraceGlobals.VerboseTracer.IsTraceEnabled(1))
            {
                ExTraceGlobals.VerboseTracer.TraceDebug <string, BackEndServer>((long)this.GetHashCode(), "[MailboxServerCache::Add]: Adding database {0} with server {1} to cache.", text, entry.BackEndServer);
            }
            if (this.TryAddToInMemoryCache(text, entry))
            {
                this.UpdateInMemoryCacheSizeCounter();
            }
            SharedCacheDiagnostics sharedCacheDiagnostics;

            this.TryAddToSharedCache(text, entry, out sharedCacheDiagnostics);
            MailboxServerCache.LogSharedCacheDiagnostics(requestContext, sharedCacheDiagnostics);
            LocalSiteMailboxServerCache.Instance.Add(database, entry.BackEndServer, entry.ResourceForest);
        }