System.Net.Cache.HttpRequestCacheValidator.UpdateCache C# (CSharp) Méthode

UpdateCache() protected méthode

This action handler is responsible for making final decision on whether a received response can be cached.

Invalid result from this method means the response must not be cached
protected UpdateCache ( ) : CacheValidationStatus
Résultat CacheValidationStatus
        protected internal override CacheValidationStatus UpdateCache() {

            if (this.Policy.Level == HttpRequestCacheLevel.NoCacheNoStore) {
                if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_removed_existing_based_on_policy, Policy.ToString()));
                return CacheValidationStatus.RemoveFromCache;
            }
            if (this.Policy.Level == HttpRequestCacheLevel.CacheOnly) {
                if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_not_updated_based_on_policy, Policy.ToString()));
                return CacheValidationStatus.DoNotUpdateCache;
            }

            if (CacheHeaders == null)
                CacheHeaders = new WebHeaderCollection();

            if (SystemMeta == null)
                SystemMeta = new NameValueCollection(1, CaseInsensitiveAscii.StaticInstance);

            if (ResponseCacheControl == null) {
                //ValidateResponse was not invoked
                FetchHeaderValues(false);
            }

            // Apply our best knowledge of HTTP caching and return the result
            // that can be hooked up and revised by the upper level
            CacheValidationStatus result = Rfc2616.OnUpdateCache(this);

            if (result == CacheValidationStatus.UpdateResponseInformation || result == CacheValidationStatus.CacheResponse)
            {
                FinallyUpdateCacheEntry();
            }
            return result;
        }