Пример #1
0
 public CacheSettings()
 {
     HandlerRegister = new CacheHandlerRegister();
     MustRevalidate  = false;
     SuppressTypeMismatchExceptions = false;
     CacheableHttpMethods           = new HashSet <HttpMethod> {
         HttpMethod.Get
     };
     CacheableHttpStatusCodes = new HashSet <HttpStatusCode> {
         HttpStatusCode.OK, HttpStatusCode.NotModified
     };
     DefaultVaryByHeaders = new HashSet <string> {
         "Accept", "Accept-Encoding"
     };
     DefaultDurationForCacheableResults = TimeSpan.FromMinutes(15);
     ResponseValidator         = (ctx, res) => CachingHelpers.ValidateResponse(res, ctx.CacheableHttpStatusCodes);
     RequestValidator          = CachingHelpers.CanCacheRequest;
     RevalidateValidator       = (ctx, res) => CachingHelpers.ShouldRevalidate(ctx.Request, res, ctx.CacheableHttpMethods);
     AllowStaleResultValidator = (ctx, res) => CachingHelpers.AllowStale(ctx.Request, res);
     DependentUris             = new HashSet <Uri>();
 }