69 references to Policy
System (69)
net\System\Net\Cache\_Rfc2616CacheValidators.cs (51)
70if (ctx.Policy.Level == HttpRequestCacheLevel.NoCacheNoStore) 80if (ctx.Policy.Level == HttpRequestCacheLevel.Reload || ctx.Policy.Level == HttpRequestCacheLevel.NoCacheNoStore) 87else if (ctx.Policy.Level == HttpRequestCacheLevel.Refresh) 94else if (ctx.Policy.Level == HttpRequestCacheLevel.Default) 97if (ctx.Policy.MinFresh > TimeSpan.Zero) { 98ctx.Request.Headers.AddInternal(HttpKnownHeaderNames.CacheControl, "min-fresh=" + (int)ctx.Policy.MinFresh.TotalSeconds); 100if (ctx.Policy.MaxAge != TimeSpan.MaxValue) { 101ctx.Request.Headers.AddInternal(HttpKnownHeaderNames.CacheControl, "max-age=" + (int)ctx.Policy.MaxAge.TotalSeconds); 103if (ctx.Policy.MaxStale > TimeSpan.Zero) { 104ctx.Request.Headers.AddInternal(HttpKnownHeaderNames.CacheControl, "max-stale=" + (int)ctx.Policy.MaxStale.TotalSeconds); 107else if (ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly || ctx.Policy.Level == HttpRequestCacheLevel.CacheOrNextCacheOnly) 161if (ctx.Policy.Level == HttpRequestCacheLevel.Revalidate) { 168if (ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly) { 181if (enoughFresh || ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly || ctx.Policy.Level == HttpRequestCacheLevel.CacheIfAvailable || ctx.Policy.Level == HttpRequestCacheLevel.CacheOrNextCacheOnly) 187if (ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly) { 194if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_valid_as_fresh_or_because_policy, ctx.Policy.ToString())); 270if (ctx.Policy.Level == HttpRequestCacheLevel.Default && ctx.ResponseAge != TimeSpan.MinValue) { 273if ( (ctx.ResponseAge > ctx.Policy.MaxAge) || 275(ctx.Policy.MinFresh > TimeSpan.Zero && (ctx.ResponseExpires - DateTime.UtcNow) < ctx.Policy.MinFresh) || 276(ctx.Policy.MaxStale > TimeSpan.Zero && (DateTime.UtcNow - ctx.ResponseExpires) > ctx.Policy.MaxStale))) 368if (ctx.Policy.Level == HttpRequestCacheLevel.Default) { 369ctx.CacheEntry.MaxStale = ctx.Policy.MaxStale; 452if (ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly) 465if (ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly) 484if (ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly) 881if (ctx.Policy.Level == HttpRequestCacheLevel.Default) 885if (ctx.Policy.MinFresh > TimeSpan.Zero) 887if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_policy_min_fresh, ((int)ctx.Policy.MinFresh.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo))); 888if (ctx.CacheAge + ctx.Policy.MinFresh >= ctx.CacheMaxAge) {return false;} 891if (ctx.Policy.MaxAge != TimeSpan.MaxValue) 893if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_policy_max_age, ((int)ctx.Policy.MaxAge.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo))); 894if (ctx.CacheAge >= ctx.Policy.MaxAge) {return false;} 897if (ctx.Policy.InternalCacheSyncDateUtc != DateTime.MinValue) 899if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_policy_cache_sync_date, ctx.Policy.InternalCacheSyncDateUtc.ToString("r", CultureInfo.CurrentCulture), ctx.CacheEntry.LastSynchronizedUtc.ToString(CultureInfo.CurrentCulture))); 900if (ctx.CacheEntry.LastSynchronizedUtc < ctx.Policy.InternalCacheSyncDateUtc) { 906if (ctx.Policy.MaxStale > TimeSpan.Zero) 908if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_policy_max_stale, ((int)ctx.Policy.MaxStale.TotalSeconds).ToString(NumberFormatInfo.InvariantInfo))); 909if (adjustedMaxAge < TimeSpan.MaxValue - ctx.Policy.MaxStale) 911adjustedMaxAge = adjustedMaxAge + ctx.Policy.MaxStale; 1288if (ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly || ctx.Policy.Level == HttpRequestCacheLevel.CacheIfAvailable || ctx.Policy.Level == HttpRequestCacheLevel.CacheOrNextCacheOnly) 1295if (ctx.Policy.Level == HttpRequestCacheLevel.Default || ctx.Policy.Level == HttpRequestCacheLevel.Revalidate) 1497if (ctx.Policy.Level == HttpRequestCacheLevel.CacheOnly &&
net\System\Net\Cache\HttpRequestCacheValidator.cs (18)
248if (this.Policy.Level != HttpRequestCacheLevel.Revalidate && base.Policy.Level >= RequestCacheLevel.Reload) 251GlobalLog.Assert("OnValidateCache()", "This validator should not be called for policy = " + Policy.ToString()); 252if(Logging.On)Logging.PrintError(Logging.RequestCache, SR.GetString(SR.net_log_cache_validator_invalid_for_policy, Policy.ToString())); 260if (this.Policy.Level == HttpRequestCacheLevel.CacheOnly) 292if (result != CacheValidationStatus.ReturnCachedResponse && this.Policy.Level == HttpRequestCacheLevel.CacheOnly) { 324if (this.Policy.Level != HttpRequestCacheLevel.Revalidate && base.Policy.Level >= RequestCacheLevel.Reload) 327GlobalLog.Assert("RevalidateCache()", "This validator should not be called for policy = " + Policy.ToString()); 328if(Logging.On)Logging.PrintError(Logging.RequestCache, SR.GetString(SR.net_log_cache_validator_invalid_for_policy, Policy.ToString())); 405if (this.Policy.Level != HttpRequestCacheLevel.CacheOrNextCacheOnly && 406this.Policy.Level != HttpRequestCacheLevel.Default && 407this.Policy.Level != HttpRequestCacheLevel.Revalidate) 410if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_response_valid_based_on_policy, Policy.ToString())); 443if (this.Policy.Level == HttpRequestCacheLevel.NoCacheNoStore) { 444if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_removed_existing_based_on_policy, Policy.ToString())); 447if (this.Policy.Level == HttpRequestCacheLevel.CacheOnly) { 448if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_not_updated_based_on_policy, Policy.ToString())); 524if (this.Policy.Level == HttpRequestCacheLevel.Default) 526CacheEntry.MaxStale = this.Policy.MaxStale;