// Token: 0x06001A79 RID: 6777 RVA: 0x0006EA5C File Offset: 0x0006CC5C
        public virtual bool Remove(ProxyAddress proxyAddress)
        {
            bool result2;

            lock (this.dictionaryLock)
            {
                Result <TEntry> result;
                if (this.dictionary.TryGetValue(proxyAddress, out result))
                {
                    this.dictionary.Remove(proxyAddress);
                    if (result.Data == null)
                    {
                        result2 = true;
                    }
                    else
                    {
                        if (ADRecipientCache <TEntry> .IsExAddress(proxyAddress))
                        {
                            this.dictionary.Remove(ADRecipientCache <TEntry> .GetPrimarySmtpAddress(result.Data));
                        }
                        else if (ADRecipientCache <TEntry> .IsSmtpAddress(proxyAddress))
                        {
                            this.dictionary.Remove(ProxyAddress.Parse(ProxyAddressPrefix.LegacyDN.PrimaryPrefix, ADRecipientCache <TEntry> .GetLegacyExchangeDN(result.Data)));
                        }
                        result2 = true;
                    }
                }
                else
                {
                    result2 = false;
                }
            }
            return(result2);
        }
        // Token: 0x06001A91 RID: 6801 RVA: 0x0006F524 File Offset: 0x0006D724
        private void AddCacheEntry(ProxyAddress proxyAddress, Result <TEntry> result, bool isLockRequired, bool populateCalculatedProperties)
        {
            TEntry data = result.Data;

            if (populateCalculatedProperties && data != null)
            {
                this.PopulateCalculatedProperties(data);
            }
            this.SetEntry(proxyAddress, result, isLockRequired);
            if (data == null)
            {
                return;
            }
            ProxyAddress primarySmtpAddress = ADRecipientCache <TEntry> .GetPrimarySmtpAddress(data);

            if (ADRecipientCache <TEntry> .IsSmtpAddress(proxyAddress))
            {
                ProxyAddress proxyAddress2 = ProxyAddress.Parse(ProxyAddressPrefix.LegacyDN.PrimaryPrefix, ADRecipientCache <TEntry> .GetLegacyExchangeDN(data));
                this.SetEntry(proxyAddress2, result, isLockRequired);
                if (null != primarySmtpAddress && primarySmtpAddress != proxyAddress)
                {
                    this.SetEntry(primarySmtpAddress, result, isLockRequired);
                    return;
                }
            }
            else if (primarySmtpAddress != null)
            {
                this.SetEntry(primarySmtpAddress, result, isLockRequired);
            }
        }
        // Token: 0x06001A76 RID: 6774 RVA: 0x0006E40C File Offset: 0x0006C60C
        public virtual Result <TEntry> FindAndCacheRecipient(ADObjectId objectId)
        {
            if (objectId == null)
            {
                throw new ArgumentNullException("objectId");
            }
            if (ADRecipientCache <TEntry> .PerfCounters != null)
            {
                ADRecipientCache <TEntry> .PerfCounters.IndividualAddressLookupsTotal.Increment();

                ADRecipientCache <TEntry> .PerfCounters.RequestsPendingTotal.Increment();

                ADRecipientCache <TEntry> .PerfCounters.AggregateHits_Base.Increment();

                ADRecipientCache <TEntry> .PerfCounters.AggregateMisses.Increment();

                ADRecipientCache <TEntry> .PerfCounters.AggregateLookupsTotal.Increment();

                this.IncrementQueriesPerCacheCounter();
            }
            Stopwatch       stopwatch = Stopwatch.StartNew();
            Result <TEntry> result;

            try
            {
                TEntry entry = default(TEntry);
                ADNotificationAdapter.RunADOperation(delegate()
                {
                    if (typeof(TEntry) == typeof(TransportMiniRecipient))
                    {
                        entry = (this.ADSession.ReadMiniRecipient <TransportMiniRecipient>(objectId, this.properties) as TEntry);
                        return;
                    }
                    if (this.isFullADRecipientObject)
                    {
                        entry = (TEntry)((object)this.ADSession.Read(objectId));
                        return;
                    }
                    entry = (TEntry)((object)this.ADSession.ReadADRawEntry(objectId, this.properties));
                });
                if (entry == null)
                {
                    result = new Result <TEntry>(default(TEntry), ProviderError.NotFound);
                }
                else
                {
                    result = new Result <TEntry>(entry, null);
                }
            }
            catch (DataValidationException ex)
            {
                ComponentTrace <ADRecipientCacheTags> .TraceError <DataValidationException>(0, -1L, "DataValidationException: {0}", ex);

                result = new Result <TEntry>(default(TEntry), ex.Error);
            }
            finally
            {
                stopwatch.Stop();
                if (ADRecipientCache <TEntry> .PerfCounters != null)
                {
                    ADRecipientCache <TEntry> .PerfCounters.AverageLookupQueryLatency.IncrementBy(stopwatch.ElapsedMilliseconds);
                }
                ADRecipientCache <TEntry> .DecrementPendingRequestsCounter();
            }
            if (result.Data != null)
            {
                ProxyAddress primarySmtpAddress = ADRecipientCache <TEntry> .GetPrimarySmtpAddress(result.Data);

                if (primarySmtpAddress != null)
                {
                    this.AddCacheEntry(primarySmtpAddress, result);
                }
            }
            return(result);
        }