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.
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: