Applying OutputCache in a REST service
In WCF REST service development, we will often encounter some cases in which we will return certain data that is very expensive to generate or is not frequently changed. For such REST service operations, WCF 4.0 adopts the OutputCache
feature in ASP.NET web application platform so that the response of WCF REST service operations can also be cached at the server side according to some user-defined cache profile settings.
In this recipe, we will show you how to use the OutputCache
feature in a WCF REST service.
How to do it...
The following steps will guide you in how to apply a simple OutputCache
profile (which makes the operation response be cached for 30 seconds) onto a sample REST service:
- Define an
OutputCache ...
Get Microsoft Windows Communication Foundation 4.0 Cookbook for Developing SOA Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.