Chapter 16. Data Caching

only for RuBoard

IN THIS CHAPTER

  • What Is Caching?

  • Using the Page Output Cache

  • Using the HttpCachePolicy Class to Enable Output Caching

  • Using Fragment Caching

  • Using the Cache APIs

  • Caching in Web Services

  • Summary

Here we are, at the last chapter in the book. You know what they say, "Save the best for last." Well, in my opinion, that is true for this book. In this chapter we'll put the "frosting on the cake." You'll learn how to enable and take advantage of caching in your Web applications.

ASP.NET has many different types of caching. There is page output caching, in which the responses for requested documents are cached and subsequent requests for that document are served from this cached version(s). Second on the list is fragment caching. Fragment caching enables you to cache portions of a page while other portions are dynamically generated for each response. Then there is data caching or object caching, in which you can cache objects such as a DataSet or ArrayList . You even can cache the output of Web services with one line of code. This chapter will cover it all. NOTE: Among other things, output caching is only available in ASP.NET Premium Edition .

In the first part of the chapter, I'll be discussing what caching is; because what one person might think of caching might be quite different from another person's perception. Within this section, I will give you a very high-level caching code example to study. Then, after you are familiar with what ASP.NET caching is, the chapter will jump head first into page output caching, which covers both the HttpCachePolicy class and the @OutputCache directive. HttpCachePolicy class enables you to implement output caching programmatically, and the @OutputCache directive is a high-level wrapper for the HttpCachePolicy class that enables you to enable output caching using a directive.

After the page output caching section, we'll be going over fragment or partial page caching, which is exactly what it sounds like. Fragment caching enables you to cache portions of a page using User Controls ( *.ascx ) while other portions are dynamically generated on each request.

The next section will cover data or object caching, which enables you to put objects such as a DataSet or ArrayList into the cache using the Cache APIs found in the System.Web.Caching namespace. Finally, I'll show you how to enable output caching within a Web service.

Specifically, the chapter discusses the following:

  • What is caching?

  • Using page output caching

  • Using fragment caching

  • Using the Cache API's

  • Implementing caching in Web services

only for RuBoard


Programming Data-Driven Web Applications with ASP. NET
Programming Data-Driven Web Applications with ASP.NET
ISBN: 0672321068
EAN: 2147483647
Year: 2000
Pages: 170

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net