public async Task<CacheEntry> GetEntryAsync(PrimaryCacheKey cacheKey)
 {
     if (_responseCache.ContainsKey(cacheKey))
     {
         return _responseCache[cacheKey].CacheEntry;
     }
     return null;
 }
Пример #2
0
        public async Task StoreResponseAsync(HttpResponseMessage response)
        {
            var primaryCacheKey = new PrimaryCacheKey(response.RequestMessage.RequestUri, response.RequestMessage.Method);

            CacheEntry cacheEntry = await _contentStore.GetEntryAsync(primaryCacheKey) ?? new CacheEntry(primaryCacheKey, response.Headers.Vary);

            var content = cacheEntry.CreateContent(response);
            await _contentStore.UpdateEntryAsync(content);

        }
Пример #3
0
 internal CacheEntry(PrimaryCacheKey key, HttpHeaderValueCollection<string> varyHeaders)
 {
     Key = key;
     VaryHeaders = varyHeaders;
 }