Click here to Skip to main content
15,885,782 members
Articles / Web Development / ASP.NET

MyCache: Distributed caching engine for an ASP.NET web farm - Part I: The demonstration

Rate me:
Please Sign up or sign in to vote.
4.85/5 (39 votes)
14 Dec 2010CPOL18 min read 94.1K   1.3K   102  
Demonstration of a distributed caching engine for ASP.NET applications deployed under a load-balanced environment in a web farm, which is built on top of WCF and the Microsoft Caching Application Block.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ViewPerformance.aspx.cs" Inherits="DistributedCache.ViewPerformance" %>
<%@ OutputCache Location="None" NoStore="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>MyCache Performance demonstration Page</title>
    <style type="text/css">
        body
        {
            font-family: Verdana;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div style="background-color:Yellow;padding:5px;font-weight:bold">
        Web Farm Id :
        <asp:Label ID="lblWebFarm" runat="server" Text=""></asp:Label>
    </div>
    <br />
    <div runat="server" id="divCacheHit" visible="false">
        <div style="background-color: Green; padding: 5px;">
            <asp:Label ID="lblCacheHit" ForeColor="White" Font-Bold="true" runat="server" Text="Cache Hit"></asp:Label>
        </div>
        <br />
        <div>
            <asp:Label ID="lblCacheHitInfo" Font-Bold="true" runat="server" Text="Data available in MyCache."></asp:Label>
            <br /><br /> 
            <asp:Label ID="lblCacheRetrievalTime" runat="server"></asp:Label> <br />
            <asp:Label ID="lblCacheRetrievalTimeFor100Data" runat="server"></asp:Label> <br />
            <asp:Label ID="lblCacheRetrievalTimeFor1000Data" runat="server"></asp:Label> 
        </div>
       
    </div>
    <div runat="server" id="divCacheMiss" visible="false">
        <div style="background-color: Red; padding: 5px;">
            <asp:Label ID="lblCacheMiss" ForeColor="White" Font-Bold="true" runat="server" Text="Cache Miss"></asp:Label>
        </div>
        <br />
        <div>
            <asp:Label ID="lblCacheMissInfo" runat="server" Font-Bold="true" Text="Data not available in Cache."></asp:Label> Read 2KB data from system and put in MyCache
        </div>
        <br />
       
    </div>
    </form>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Founder SmartAspects
Bangladesh Bangladesh
I write codes to make life easier, and that pretty much describes me.

Comments and Discussions