As mentioned in another question , we use WCF-RIA Services in our project in combination with the silverlight navigation map. There is a search function on the part. The search button will go to a special search page, placing the search request in the URL, which then initiates the RIA request on the server.
For this request, we have included the client output cache using this attribute:
[OutputCache(OutputCacheLocation.Client, duration: 2 * 60)]
Now, sometimes (especially in the demo), our users know that the underlying data source has changed and they want to update the search to see the current results.
Installing LoadOperations LoadBehavior did not update the cache.
Now we have a (partial) solution: we have added a special cache counter property to our service. This property is ignored by the service and is used only for working with the cache. Whenever the user clicks the search button, the cache counter increases, and we work around the cache. If the user is moved back or redirected to the search page, the search counter is retrieved from Url and the request is served by the cache.
The question arises: is there a better way to force update the clientβs cache?
Optional: our workaround is not suitable if the user selects the browser refresh button to refresh the search page. In this case, the cache counter is still taken from the URL and the data is retrieved from the cache instead of the server. I did not find a way to detect the update from our silverlight client (I saw one sentence using a server-side session variable, which is not an option, because our server is completely stateless).
source share