コード例 #1
0
        public async Task <Possible <CasEntries, Failure> > GetCacheEntryAsync(StrongFingerprint strong, UrgencyHint urgencyHint, Guid activityId)
        {
            Contract.Requires(!IsClosed);
            Contract.Requires(strong != null);

            using (var counter = m_counters.GetCacheEntryCounter())
            {
                using (var eventing = new GetCacheEntryActivity(BasicFilesystemCache.EventSource, activityId, this))
                {
                    eventing.Start(strong, urgencyHint);

                    var result = await m_cache.ReadCacheEntryAsync(strong);

                    if (result.Succeeded)
                    {
                        AddSessionRecord(strong);
                        counter.CacheHit();
                        result = result.Result.GetModifiedCasEntriesWithDeterminism(m_cache.IsAuthoritative, m_cache.CacheGuid, DateTime.UtcNow.Add(m_cache.TimeToLive));
                    }

                    return(eventing.Returns(result));
                }
            }
        }