Search code examples
c#windows-phone-7cachingresthammock

Does Hammock cache requests?


I'm using Hammock in a Windows Phone app to request data from a REST service. I have a photo album page that shows a list of thumbnails. On this page, I have a button to upload a photo to the service. After a success response is received I'm calling my GetPhotos method again to refresh the thumbnail view. However every time I call this in a current session, I always get back the original number of photos. I can load a different album on the page and then reload this album and the new photo is still not included in the rest response. I can go to the site and see the photo was uploaded, but I can't get it to return in the api unless I restart my app.

(I also have a request in with the service to see if there is caching on their end)

Any clue if there is caching going on here on the hammock or even windows phone side?


Solution

  • On the server side, make sure you are setting the Caching to NoCache. Your mileage may vary depending on what you're using to implement your REST service, but something along the lines of:

    Response.Cache.SetCacheability(HttpCacheability.NoCache);