I am using esri's js api with arcserver 10.1 map services. My issue is that sometimes another application deletes a feature from the geodatabase that is the basis for my map service. But my browser does not react quickly to the change. It seems to be caching the map service response. This is evident in ie and firefox. Even a browser refresh will still show the feature that should have been deleted already. Is there a way to force the cache to flush and get new map service data?
You should use the disableClientCaching on the Dynamic Map Services, and set it to true.
The help states:
When true, images are always requested from the server and the browser's cache is ignored. This should be used when the data supporting the map service changes frequently.
What this does, is to add a timestamp at the end of every request, so that every request is unique, and hence the client can't cache the response.
in addition to setting disableClientCaching, you can also set a refreshInterval on the layer in order to force new requests to the service even in instances where the user hasn't panned or zoomed.