2

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

1 Answer 1

1

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.

2
  • 2
    +1. uggly but, easy and reliable way to do it is adding a unique parameter, such as "&stamp="+(new Date()).getTime()
    – back2dos
    Jul 7, 2010 at 12:08
  • Thanks a mill, setting the header in flash didnt work, but setting the header in the WCF service did! heres the link so see how to set the headers: robbagby.com/rest/…
    – kyle
    Jul 7, 2010 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.