dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.99k stars 4.66k forks source link

[browser] Cache identity per query string #85775

Open pavelsavara opened 1 year ago

pavelsavara commented 1 year ago

The cache in the WebAssemblyResourceLoader and also the memory snapshot creates different cache for each app. The current logic takes index.html?item=123 out of http://localhost:53504/index.html?item=123 as cache name.

Therefore the cache is not loaded when user arrived from external deep link item=123 or if the same app has multiple html pages.

If we fully migrate to assets hashes in the asset name, we could drop WebAssemblyResourceLoader. But the problem would stay for memory snapshot.

@maraf suggested that we could generate Application GUID during build. I guess we would put it into the boot.config.json ?

ghost commented 1 year ago

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

Issue Details
The cache in the `WebAssemblyResourceLoader` and also the memory snapshot creates different cache for each app. The current logic takes `index.html?item=123` out of `http://localhost:53504/index.html?item=123` as cache name. Therefore the cache is not loaded when user arrived from external deep link `item=123` or if the same app has multiple html pages. If we fully migrate to assets hashes in the asset name, we could drop `WebAssemblyResourceLoader`. But the problem would stay for memory snapshot. @maraf suggested that we could generate Application GUID during build. I guess we would put it into the `boot.config.json` ?
Author: pavelsavara
Assignees: pavelsavara, maraf
Labels: `arch-wasm`, `area-System.Runtime.InteropServices.JavaScript`
Milestone: 8.0.0
pavelsavara commented 1 year ago

cc @javiercn thoughts ?

maraf commented 1 year ago

I believe the cache key could/should be similar to what @pavelsavara implemented for memory snapshot cache - hash of all configuration params + assets hashes

pavelsavara commented 1 year ago

I think we could still do this in net8 after https://github.com/dotnet/runtime/pull/89435

pavelsavara commented 1 year ago

It may improve situation for https://github.com/dotnet/aspnetcore/issues/41353

pavelsavara commented 4 months ago

I think we are close to be able to drop the custom Cache and use just HTTP cache + names with hash in it.

maraf commented 2 months ago

I think we are close to be able to drop the custom Cache and use just HTTP cache + names with hash in it.

After the last discussion, this is not the case ATM. Keeping this open