开发者

Flash Caching Issue?

I am having the following problem:

I have a WCF service that checks a database table and returns the results vis JSON to a flash app.

The flash app polls the WCF service every 2 seconds until the records are ready. The issue is that flash seems to be caching my requests, as after the first request the service never gets hit again!

I have found a workaround, by appending a random number onto the query string but there has to be a better way around this than that??

any inp开发者_如何学Cut is greatly appreciated.

Cheers


Appending a random string is the most commonly used way to get around the cache.

You can try setting pragma: no-cache header, but I am not sure this will be honored; I have a faint memory of this not working for me in the past - please see it for yourself and post back :-)

var header:URLRequestHeader = new URLRequestHeader("pragma", "no-cache");
var request:URLRequest = new URLRequest(url);
request.requestHeaders.push(header);

If you have control over the web service, you can send pragma: no-cache header, which I assume you'd be doing already.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜