Skip to content
This repository has been archived by the owner on Jun 24, 2019. It is now read-only.

Cache on mobile #9

Open
iBicha opened this issue Apr 26, 2018 · 5 comments
Open

Cache on mobile #9

iBicha opened this issue Apr 26, 2018 · 5 comments

Comments

@iBicha
Copy link

iBicha commented Apr 26, 2018

Is there a reason why caching is only on Desktop? I did a few modifications and caching works on mobile. Is there something I'm missing?

@btco
Copy link
Contributor

btco commented Apr 26, 2018

There is no profound reason. We just didn't include it in the official release because it didn't get enough testing. Particularly, it's hard to judge what the size of the cache should be since phones have widely different storage capacities so while a 2GB cache may be reasonable on a 64GB phone, it's not so reasonable on a 16GB phone.

@iBicha
Copy link
Author

iBicha commented Apr 26, 2018

I see. I left the default to 512MB, and it kinda worked.
I did notice something really strange though. (I didn't open an issue, since it is not officially supported yet) but here it is:

After allowing cache on mobile:

      bool cacheSupported = Application.platform == RuntimePlatform.WindowsEditor ||
        Application.platform == RuntimePlatform.WindowsPlayer ||
        Application.platform == RuntimePlatform.OSXEditor ||
        Application.platform == RuntimePlatform.OSXPlayer ||
        Application.platform == RuntimePlatform.Android ||
        Application.platform == RuntimePlatform.IPhonePlayer;

and my cache path is

        string defaultCachePath = Path.Combine(Application.persistentDataPath, "WebRequestCache");

a PolyListAssetsRequest with keywords succeeds on both desktop and Android. But a PolyListAssetsRequest without keywords, and curated set to true, succeeds on desktop, and fails on Android with a 500 Error (which is really weird, because I don't know what a server error has to do with caching)

So the fail conditions are:
On mobile (tested on Android)
Cache enabled
curated set to true

Edit:
BufferHolder.tempBuffer and BufferHolder.dataBuffer are used nowhere in the project, I set both TEMP_BUFFER_SIZE and DATA_BUFFER_INIT_SIZE to 0.
That solved the problem. (probably related to an out of memory exception, that Unity reported as a 500)

@btco
Copy link
Contributor

btco commented Apr 26, 2018

Nice! This is really useful info. Thanks for investigating!

@iBicha
Copy link
Author

iBicha commented Aug 10, 2018

Oh I just wanted to rectify this and I forgot, I was wrong about caching, since it is specific to asset bundles, and not arbitrary downloaded files. But the temporaryCachePath can indeed be used for caching (I think it is the preferred way, as it can be cleared from the app info in android for example)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants