Disable Caching on FeatureLayer.refresh()

Discussion created by jcornwell-shiel on Apr 9, 2012
Latest reply on Apr 3, 2013 by cminde7
Is there a way to disable caching on an OnDemand mode FeatureLayer? When I use the .refresh() method it refreshes, but more often than not the actual data returned isn't different, and I know that the layer has been updated. Zooming updates the data at the new zoom level, but on returning to the original scale the features are back to what was originally loaded.

I've tried manually updating the url of the FeatureLayer with a timestamped querystring via two methods:

var newtimestamp = new Date().getTime();
layer.url = layer.url.replace(/nocache=.*/,'nocache='+newtimestamp);


var newtimestamp = new Date().getTime();
layer._url.query.nocache = newtimestamp;

Neither actually changes the URL hit by the layer.refresh() though. Any suggestion on what method/variable to use to do this, or a different way to get around this caching issue?

Thanks in advance!