O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Add Data Caching

Problem

You want to improve Web service performance by caching some data, but you need to reuse cached data among several methods. Or, you want to run your Web method code but still use some cached information.

Solution

Store any object in the cache using the Cache object.

Discussion

Data caching with a Web service works almost exactly the same as the Web page data caching technique described in recipe Store Arbitrary Data in the ASP.NET Cache. In fact, you can store data in the cache using Web page code and retrieve it in a Web service, or vice versa. Data caching supports two types of expiration policy: absolute expiration and sliding expiration. For more information, refer to recipe Store Arbitrary Data in the ASP.NET Cache.

The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required