How to clear www cache?

Im using www to download the xml file from a section for my only web application. It extracts the file and everything works fine. The problem occurs when I update the xml file on my server, Unity doesn't seem to load new data, but displays old data instead. He does some kind of cache that really doesn't help me.

I looked through the docs and found the WWW.LoadFromCacheOrDownload method, but this only works for asset packages. I also deleted the xml file on my server, but when I run the application, it still shows me the data from the initially loaded xml i (This confirms the cache).

Is there a way that I can force unity to download a new version of my xml every time I download it, rather than using the cache.

I hope I understand. Looking forward to some good suggestions!

+4
source share
1 answer

Perhaps you can provide a different URL for your WWW download code. Just add a timestamp parameter. For instance:

http://www.example.com/myfile.xml 

becomes

 http://www.example.com/myfile.xml?p=13457889 

Where 13457889 is the current time in milliseconds. Each URL will be unique and caching will fail.

+7
source

Source: https://habr.com/ru/post/1394408/


All Articles