November 25, 2014
Hot Topics:

Tip: Improve Web Service Performance, with Caching

  • November 12, 2003
  • By Karl Moore
  • Send Email »
  • More Articles »

It's a little-known fact, but you can actually "cache" what a Web service gives out and automatically serve up the same response next time, seriously speeding up popular, processor-intensive services.

How? Simply specify a CacheDuration parameter in the WebMethod attribute, like this:

    <WebMethod(CacheDuration:=60)> _
    Public Function GetWeather() As String
        ' ... complicated code ...
    End Function

Here, the Web server will cache and serve up the same results for GetWeather 60 seconds after the last query. You can see this cute tip in action by returning the time from a function. See what happens?

About the Author

Karl Moore (MCSD, MVP) is an experience author living in Yorkshire, England. He is author of numerous technology books, including the new Ultimate VB .NET and ASP.NET Code Book (ISBN 1-59059-106-2, $49.99), plus regularly features at industry conferences and on BBC radio. Moore also runs his own creative consultancy, White Cliff Computing Ltd. Visit his official Web site at www.karlmoore.com.






Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Sitemap | Contact Us

Rocket Fuel