如何阻止 FLEX 缓存? [英] how to stop FLEX from caching?

查看:29
本文介绍了如何阻止 FLEX 缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个不是我自己设计的 flex 应用程序,事实上我真的不太了解 flex 的工作原理.我想禁用所有缓存,因为自从我们更改为新的付款方式以来,它会导致很多问题.

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.

我尝试在标题中设置它,这是我的 index.html 的一段代码

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?

推荐答案

Flex 应用程序实际上只是一个 Flash 文件,它是一个带有 .swf 扩展名的文件.就像网页中的任何其他资产一样,您只需更改文件名即可使其重新加载.您能做的最好的事情是在该文件名中包含内部版本号.

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.

假设此时文件名为 MyApp.swf,您可以将其重命名为 MyApp-2.0.swf 并在您发布新文件时更改内部版本号版本.
另一种选择是将内部版本号作为 URL 参数传递,如下所示:MyApp.swf?v=2.0,但根据我的经验,这不太可靠.

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.

另外不要忘记服务器可能会缓存整个页面.如果是这种情况,它会继续加载旧的 MyApp.swf,即使您更改了名称.如何防止这种情况,取决于服务器端语言.

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.

这篇关于如何阻止 FLEX 缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆