Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Refreshing in RestSharp for Windows Phone

I implemented RestSharp succesfully in my WP7 application, but one issue remains:

When I load resources from the server (for example a GET request on http://localhost:8080/cars), the first time the collection of (in this case) cars is succesfully returned.

When I issue the same request for the second time, I always get the same result as the first time - even when the resources have changed in the meantime. When looking at my server, the second time there is no request issued at all.

I presume there's a caching mechanism implemented in RestSharp, but I see no way to invalidate the cache results.

Are there any ways to manually invalidate the RestSharp for Windows Phone cache results? (Or ways to force the library to get the results from the server)

like image 883
vstrien Avatar asked Dec 12 '25 17:12

vstrien


1 Answers

You can control caching of resources by setting headers on the response your server sends back. If you do not want the resource to be cached then set the cache-control header to no-cache.
It is the server's job to specify how long a resource is good for, the client should do its best to respect that information.

If you really, really want to delete entries in the cache you need to go via the WinINet API

like image 140
Darrel Miller Avatar answered Dec 15 '25 16:12

Darrel Miller



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!