Answered by:

Caching in WCF data services?

Question

I'd like to use WCF data services in a proof of concept application. I need to know if I used an Entity Framework EDM surfaced through WCF Data Services, would each Data Services query result in a separate call to the database (through the context.) If so, is there a way to cache the data so that most requests get served from memory, and only expired data results in database calls.

Answers

As for the caching, do you mean the caching at client-side? If so, so far WCF service or DataService doesn't provide built-in cache support. If your WCF service is of REST style and the client is using webbrowser to access, it is possible to utilize the client caching of webbrowser for a certain resource at a given url. If you need to consume the WCF service through .NET client proxy class, you might consider building a wrapper class which perform the cache itself(such as using the Cache application block in enterprise library).

All replies

As for the caching, do you mean the caching at client-side? If so, so far WCF service or DataService doesn't provide built-in cache support. If your WCF service is of REST style and the client is using webbrowser to access, it is possible to utilize the client caching of webbrowser for a certain resource at a given url. If you need to consume the WCF service through .NET client proxy class, you might consider building a wrapper class which perform the cache itself(such as using the Cache application block in enterprise library).

It seems that you dont understand how browser level caching works. WCF or any REST based interface can set the the exipriation timeout in the standard header. When set the requests are cached on the client side and managed by the browser.