Aggressive Flash Caching

I have a flash application that downloads a large piece of data, which changes sometimes , so I configured my server to send headers Last-Modifiedand response using 304 Not Modifiedwhen the client version is not outdated.

It works fine in every browser, but Flash completely ignores this and aggressively caches the resource. It does not even send a request to the server, it just retrieves the cached file from disk when trying an URLLoader.loadearlier visited URL.

The workarounds that I find on google do not help me - either cache forever, or reload the resource each time (by changing the URL parameters). I need a mixture of them - redownload, when the resource is updated, otherwise use the cache.

+3
source share
2 answers

You can use the version number as the URL parameter ... Thus, it will not be reloaded every time Flash Player loads, only when you actually change the version number

+4
source

I don't know if this will work, but it's worth a try.

You can try adding the caching code to the file. You usually do this by adding a random string of characters to the end of the file name, for example. new URLRequest("bigFile.foo?uncache=273095285209750"). For you, instead of using a random string, you can use a date object to generate a string. For instance...

var now:Date = new Date();
var request:URLRequest = new URLRequest("bigFile.foo?uncache=" + new Date(now.year, now.month, now.date));

, , ( , ). , script, , , .

, !

+1

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


All Articles