Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 39,696 times

Contents

Related Categories

.NET Data Caching - Introduction

DMarko1

Introduction

In simple terms data caching is storing data in memory for quick access. Typically information that is costly to obtain (in terms of performance) is stored in the cache. One of the more common items stored in a cache in a Web application environment is commonly displayed database values; by caching such information, rather than relying on repeated database calls, the demand on the Web server and database server's system resources are decreased and the Web application's scalability increased. As Microsoft eloquently puts it, "Caching is a technique widely used in computing to increase performance by keeping frequently accessed or expensive data in memory. In the context of a Web application, caching is used to retain pages or data across HTTP requests and reuse them without the expense of recreating them."

In classic ASP we didn't have anything nearly as sophisticated nor as powerful as the ASP.NET caching API that is now available to us. With .NET we have the ability to cache whole pages (output caching), parts of pages or server controls (fragment caching) and data caching with the lower-level Cache API.

In this article I will be examining data caching in detail. For more information on output caching see Page Output Caching from the ASP.NET QuickStarts. For more information on fragment caching, see Page Fragment Caching from the ASP.NET QuickStarts.

This article was originally published on 4guysfromrolla.com.

Dimitrios, or Jimmy as his friends call him, is a .NET developer/architect who specializes in Microsoft Technologies for creating high-performance and scalable data-driven enterprise Web and desktop applications. Till now Jimmy has authored nearly two dozen .NET articles, published on Dot Net Junkies, 4 Guys From Rolla, Sitepoint, MSDN Academic Alliance, Developers.NET, The Official Microsoft ASP.NET Site, and here on Developer Fusion, covering various unique and advanced techniques on .NET.

Comments

  • Cache is not Available

    Posted by muthup on 30 Apr 2005

    So , Does That mean this is a Genuine Microsoft Bug??
    No matter What If I Use this Syntax[ Colorede red] to acess the Cache Object I get an Exception...
    internal class EnvUtil :System.Web.UI.Page {...

  • Posted by James Crowley on 30 Apr 2005

    Just because the Cache cannot be inherited, doesn't mean you can't access it when you are inheriting the Page class -

    public class MyClass : System.Web.UI.Page {
    public Object SomeMethod() {
    ...

  • Cache is not Available

    Posted by muthup on 30 Apr 2005

    I stumbled into this problem. The comment is correct The Cache class is a sealed class, which means it cannot be inherited. Since you are inheriting the Page class in your X testClass the Cache object...

  • Posted by DMarko1 on 23 Mar 2005


    Hi Charlie,

    You can use .NET remoting when you need to keep your cache across processes. The process is discussed here [url="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda...

  • Access a cache object from a class

    Posted by DMarko1 on 23 Mar 2005

    Hi all, this article unfortunately doesn't deal with class caching. However, in my latest article posted here on DeveloperFusion -[url="http://www.developerfusion.co.uk/show/4676/"]Building a Full-Fea...