Search code examples
c#blazorblazor-server-sideblazor-client-side

What cache strategy should be used for Blazor apps?


I've been testing out Blazor, and I can't find any documentation on how to implement browser caching (either with static files like images, css, js etc, but also the dll files that are downloaded).

Is it possible to cache static and dll files in Blazor at all?


Solution

  • As of Blazor WASM 3.2-preview2 release, when an app is initially loaded, the runtime and framework files are now stored in the browser cache storage. When the app loads, it first uses the contents of the blazor.boot.json to check if it already has all of the runtime and framework files it needs in the cache. If it does, then no additional network requests are necessary.

    You can read more about this in Improved framework caching section of the Blazor WASM release blog post.