how to stop FLEX from caching?

2019-06-11 07:53发布

i'm working with a flex app I didnt design myself, in fact i really don't know much about the workings of flex. I want to disable all caching since its causing a lot of problems since we changed to a new payment method.

I know the disabling cache isnt ideal, but it just needs to be done for the moment. I found a server side solution for this, but my implementation of it doesn't seem to work.

i tried setting it in the header, here's the piece of code for my index.html

<head>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...........

Maybe someone with experience on this matter is willing to help be out?

1条回答
爷、活的狠高调
2楼-- · 2019-06-11 08:31

A Flex application is in fact just a Flash file, which is a file with the .swf extension. Just like any other asset in a web page, you can make it reload simply by changing the filename. The best thing you can do, is to include a build number in that filename.

Suppose at the moment the file is called MyApp.swf, you could rename it to MyApp-2.0.swf and just change the build number whenever you publish a new version.
Another option would be to pass the build number as a URL paramter like so: MyApp.swf?v=2.0, but in my experience that's slightly less reliable.

Also don't forget that the server might cache the entire page. If that's the case, it would keep loading the old MyApp.swf, even if you changed the name. How to prevent this, depends on the server side language.

查看更多
登录 后发表回答