kyle
kyle

Reputation: 183

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 input is greatly appreciated.

Cheers

Upvotes: 2

Views: 213

Answers (1)

Amarghosh
Amarghosh

Reputation: 59451

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.

Upvotes: 1

Related Questions