From 41f58191bfe120b8ed74f2369f50ee68bda9bf30 Mon Sep 17 00:00:00 2001 From: John Luo Date: Tue, 15 Nov 2016 15:57:56 -0800 Subject: [PATCH] Update sample to add a README.md file --- samples/ResponseCachingSample/README.md | 6 ++++++ samples/ResponseCachingSample/Startup.cs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 samples/ResponseCachingSample/README.md diff --git a/samples/ResponseCachingSample/README.md b/samples/ResponseCachingSample/README.md new file mode 100644 index 0000000000..08583fda40 --- /dev/null +++ b/samples/ResponseCachingSample/README.md @@ -0,0 +1,6 @@ +ASP.NET Core Response Caching Sample +=================================== + +This sample illustrates the usage of ASP.NET Core response caching middleware. The application sends a `Hello World!` message and the current time along with a `Cache-Control` header to configure caching behavior. The application also sends a `Vary` header to configure the cache to serve the response only if the `Accept-Encoding` header of subsequent requests matches that from the original request. + +When running the sample, a response will be served from cache when possible and will be stored for up to 10 seconds. diff --git a/samples/ResponseCachingSample/Startup.cs b/samples/ResponseCachingSample/Startup.cs index cd135b8451..ca2e7fbcf3 100644 --- a/samples/ResponseCachingSample/Startup.cs +++ b/samples/ResponseCachingSample/Startup.cs @@ -28,7 +28,7 @@ namespace ResponseCachingSample Public = true, MaxAge = TimeSpan.FromSeconds(10) }; - context.Response.Headers[HeaderNames.Vary] = new string[] { "Accept-Encoding", "Non-Existent" }; + context.Response.Headers[HeaderNames.Vary] = new string[] { "Accept-Encoding" }; await context.Response.WriteAsync("Hello World! " + DateTime.UtcNow); });