AspNetCore.Docs icon indicating copy to clipboard operation
AspNetCore.Docs copied to clipboard

[Pre6] Blazor custom cache removed

Open maraf opened this issue 6 months ago • 3 comments

In https://github.com/dotnet/runtime/pull/114901 we have removed custom cache. Since we now rely on standard web technologies, like fingerprinting files, using import maps, doesn't have real value anymore.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

maraf avatar Jun 13 '25 08:06 maraf

@maraf ... A few questions on this one ...

  1. This is for Preview 6?

  2. Can you let me know if the entire following article should now be dropped out at 10.0 and later ...

    https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly/bundle-caching-and-integrity-check-failures?view=aspnetcore-10.0

  3. Does this change affect the caching that the service worker does in PWAs? For example, the caching discussed for PWAs is described in ...

    https://learn.microsoft.com/en-us/aspnet/core/blazor/progressive-web-app?view=aspnetcore-9.0&tabs=visual-studio#cache-first-fetch-strategy

    https://learn.microsoft.com/en-us/aspnet/core/blazor/fundamentals/configuration?view=aspnetcore-10.0#cached-configuration

  4. For places where a passing remark is made about asset caching, for example ...

    The .NET runtime and app bundle are downloaded and cached when the WebAssembly component is initially rendered.

    It's helpful for maintaining the docs (and cheaper 💰) to avoid versioning content as much as possible. I'd like to see if we can drop just the "and cached" language from remarks like that and avoid versioning sentences, whole paragraphs, and entire bullet lists just get rid of small passing remarks about caching. I'll ping you on the PR for the changes so that you can let me know if some bit of knocked out language is critical to keep for prior releases. In those cases, we'll bite the bullet and version the text. Sound good?

guardrex avatar Jun 13 '25 12:06 guardrex

  1. Yes
  2. Partially, but not completely. Browser still validates integrity, but thanks to files being fingerprinted (= unique urls), we don't need to do the dance with always fetching boot config & validating what changed manually, instead browser do it on its own. Also this section blazor.js query param is mostly obsolete thanks to fingerprinting.
  3. No, PWA is not affected
  4. In fact, the assets are still cached, using standard web mechanisms for caching, we only dropped the additional cache layer, that is not needed anymore

maraf avatar Jun 13 '25 13:06 maraf

Thanks ...

  1. I'll try to figure out for the PR which parts to drop. You can let me know on review.

...

  1. I see. Yes, that makes sense to me. That's good. I'd like to avoid as much versioning as possible.

guardrex avatar Jun 13 '25 13:06 guardrex

@guardrex Now that resources are not cached in the custom cache, applications will be more sensitive to server caching properly set. I'm thinking if we should call that out somehow in docs, or if we have it covered somewhere. It might be different based on server application and hosting model

maraf avatar Jul 25 '25 12:07 maraf

I opened #35821 on it.

guardrex avatar Jul 25 '25 12:07 guardrex