ASP.NET Podcast

ASP.NET Podcast is geared towards the Microsoft .NET Framework and ASP.NET.
The podcast is run by Wally McClure, David Penton, and Paul Glavich.
Welcome to ASP.NET Podcast Sign in | Join | Help
in Search

ASP.NET Podcast

The ASP.NET Podcast features, technical talks, interviews, news, reviews, and Wallyisms. Wallace B. (Wally) McClure, David Penton, and Paul Glavich are your hosts. We talk about ASP.NET, AJAX, Performance, Databases, WCF, Silverlight, Cloud Computing, Windows Azure, and whatever else we decide to talk about.

ASP.NET Podcast Show #129 - Caching with .NET 3.5 SP1

Subscribe to All!

Subscribe to WMV.

Subscribe to M4V (iPod).

Subscribe to MP3.

Download WMV.

Download M4V (iPod).

Download MP3.

Show Notes:

  • New Caching Support in .NET 3.5 SP1.

Source Code:

    protected void Page_Load(object sender, EventArgs e)


        string Output = String.Empty;

        if (!Page.IsPostBack)


            lblOutput.Text = GetCacheItem();




    private string GetCacheItem()


        string OutValue = String.Empty;

        if (Cache["Test"] != null)


            OutValue = Convert.ToString(Cache["Test"]);




            OutValue = DateTime.Now.ToString();

            Cache.Insert("Test", OutValue, null,


                TimeSpan.Zero, OnUpdateCallback);


        return (OutValue);


    private void OnUpdateCallback(String key, CacheItemUpdateReason r,

        out Object ObjectToCreate, out CacheDependency CacheDependencies,

        out DateTime DateTimeExpire, out TimeSpan TimeSpanExpire)


        ObjectToCreate = DateTime.Now;

        CacheDependencies = null;

        DateTimeExpire = DateTime.Now.AddSeconds(10);

        TimeSpanExpire = TimeSpan.Zero;



Published Thursday, December 04, 2008 4:00 AM by admin
Anonymous comments are disabled

This Blog


Powered by Community Server, by Telligent Systems