Skip to content

Add multi-platform aware cache.#704

Merged
dooly123 merged 3 commits intoBasisVR:developerfrom
Toys0125:Platform-Aware-Cache
Mar 31, 2026
Merged

Add multi-platform aware cache.#704
dooly123 merged 3 commits intoBasisVR:developerfrom
Toys0125:Platform-Aware-Cache

Conversation

@Toys0125
Copy link
Copy Markdown
Contributor

Branch summary: Platform-aware cache for downloaded BEE/BME content.

This branch adds multi-platform awareness to the shared bundle cache so Linux and Windows builds no longer clobber each other when they download the same remote content. Previously the cache keyed on remote URL and UniqueVersion only, which meant avatars, props, worlds, preloads, and content-share items could reuse or overwrite the wrong platform payload. That would cause cases where metadata said a platform was supported but the cached bytes on disk were actually from another platform.

What changed:

  • Added DownloadedPlatform to BEE metadata.
  • Made BEE/BME cache filenames platform-aware.
  • Made the on-disk metadata index platform-aware instead of URL-only.
  • Prefer the current runtime platform when resolving cached content.
  • Force a redownload when an older cached bundle is present but fails to load.
  • Updated cache listing, eviction, deletion, and clear-cache flows to handle multiple platform variants of the same remote URL correctly.

Scope:

  • Basis/Packages/com.basis.bundlemanagement/BasisBEEExtensionMeta.cs
  • Basis/Packages/com.basis.bundlemanagement/BasisBeeManagement.cs
  • Basis/Packages/com.basis.bundlemanagement/BasisIOManagement.cs
  • Basis/Packages/com.basis.bundlemanagement/BasisLoadhandler.cs
  • Basis/Packages/com.basis.bundlemanagement/BasisStorageManagement.cs

Net result:

  • A StandaloneLinux download no longer overwrites the StandaloneWindows cache entry for the same content, and vice versa.
  • The fix applies across all content types that use the shared bundle cache, not just avatars.
  • Older cache entries are still handled defensively through fallback path resolution and redownload-on-failure behavior.

AssetBundleCreateRequest bundleRequest = await BasisEncryptionToData.GenerateBundleFromFile(wrapper.LoadableBundle.UnlockPassword, output.Item2, output.Item1.AssetBundleCRC, report);
if (bundleRequest == null || bundleRequest.assetBundle == null)
{
if (shouldUseOnDiskMeta && !didForceRedownload)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this cause a feedback loop of no bad bundle -> download -> attempt bad bundle -> download repeating

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The next check of didForceRedownload is the check flag so it only does it once per invocation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only thing we could do is either delete the bad local file, and return an error about the download being bad.

@dooly123
Copy link
Copy Markdown
Collaborator

Would separating the folder structure also help to reduce churn of redownloading?

@Toys0125
Copy link
Copy Markdown
Contributor Author

Would separating the folder structure also help to reduce churn of redownloading?

Only redownload when it fails to load the cache. So atm it just leaves the old cache file.
So its uniquefilename-platform.BEE for the cache on new downloads only.

@Toys0125
Copy link
Copy Markdown
Contributor Author

Would separating the folder structure also help to reduce churn of redownloading?

Granted using separate folders will reduce Startup Churn.

@dooly123 dooly123 merged commit 61dc4b6 into BasisVR:developer Mar 31, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants