Aspnetcore.docs: performance/caching/middleware.md "Response caching middleware"

Created on 17 Nov 2016  Â·  10Comments  Â·  Source: dotnet/AspNetCore.Docs

@GuardRex meeting notes
go at it.

All 10 comments

@JunTaoLuo Just adding myself here so I'll get an E-mail from GH when the outline is ready.

There's a subscribe button you'll find pretty useful :)

On Wed, Nov 30, 2016, 20:45 Luke Latham notifications@github.com wrote:

@JunTaoLuo https://github.com/JunTaoLuo Just adding myself here so I'll
get an E-mail from GH when the outline is ready.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/aspnet/Docs/issues/2198#issuecomment-264033305, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABeg9LiW7HHSOMtAT39bYGAukAfSJgGEks5rDgqAgaJpZM4K0yIR
.

I'm subscribed to this repo's issues, but I don't get E-mail from GH on a specific issue unless I post to it. I just want to make sure I get an E-mail on this one so I can jump right on it when the outline is ready. [The Rex is lick'in his chops to get into this! :smile: ]

Topics to include:

  • Sample
  • Extensions needed to use the middleware

    • AddResponseCaching(), UseResponseCaching()

  • Options

    • UseCaseSensitivePaths

    • MaximumBodySize

  • ResponseCachingFeature

    • VaryByQueryKeys

  • functions as an HTTP cache

    • relevant headers:

    • Authorization (we do not cache if it exists)

    • Cache-Control

    • max-age, max-stale, min-fresh, must-revalidate, no-cache, no-store, only-if-cached, private, public, s-maxage, proxy-revalidate

    • Pragma

    • no-cache

    • Set-Cookie

    • Vary

    • Expires

    • If-None-Match

    • If-Modified-Since

    • The middleware also sets the following when appropriate:

    • Date

    • Age

    • Content-Length

@GuardRex Thanks for helping out, let me know if you have any questions.

@GuardRex meeting notes

@JunTaoLuo Thanks John. I'll be wrapping the Pub IIS doc with Tom's feedback by tomorrow afternoon. I want to take a quick look at the use of "command line" language (Docs/2248) and get back to to Tom on that Wednesday afternoon, then I'll get right on this.

@JunTaoLuo Bit of a side-question, but I'm confused on seeing ...

context.Response.Headers[HeaderNames.Vary] = new string[] { "Accept-Encoding" };

I would have expected to see it in a compression sample, where the Response Compression Middleware changes the encoding but doesn't set the header automatically AFAICT from my testing.

In a purely caching sample, where there only ever is one encoding (text/plain in the sample, for example), do you want that there? ... I mean the Response Caching Middleware never changes the encoding all by itself, does it?

[EDIT] Also, I see Microsoft.Extensions.Caching.Memory as a listed dep in project.json, but that package seems to be pulled in by Microsoft.AspNetCore.ResponseCaching. Should it be listed ... is it a delta for 1.2?

@GuardRex The Vary in the sample was there to illustrate how to vary the cached response by another header. In the example, the Accept-Encoding header was used but we could have used any other header. The Microsoft.Extensions.Caching.Memory dependency is unnecessary as you have mentioned and seems to be something that was not cleaned up.

@JunTaoLuo I'm researching whether or not it is relevant to mention disabling IIS output caching in web.config for an app that prefers to use the middleware where IIS has been configured at the server level to cache objects.

I ran a test with the HttpCacheModule ...

  1. a non-ANCM site to confirm IIS output caching was working normally (it worked :+1:)
  2. a non-middlware ANCM-Kestrel site serving the same test image with the same Cache-Control header

I couldn't get the IIS module to cache the test image from the ANCM-Kestrel site. so it looks like the module isn't effective with reverse-proxy setups. Is that correct? If it should work, I'll go back and check my test setup again.

Was this page helpful?
0 / 5 - 0 ratings