1

I see on the web there are a lot of questions about caching ASP.Net, but not a lot of discussion on caching options for a Smart Client Application and their databases.

What are the data caching options that are available for Smart Client Application on the .Net framework, and how are any of you using them?


Edit

Enterprise Framework was mentioned below, thoughts?

amazedsaint
  • 7,642
  • 7
  • 54
  • 83
Tom Anderson
  • 10,807
  • 3
  • 46
  • 63

3 Answers3

2

Caching frequently accessed data is required/desirable in Winforms Smart Client applications. Reading data from cache is often faster than hitting your data providers/web services.

Here are a couple of options with examples

  1. Enterprise library's caching application block is a good choice.
  2. Also, System.Web.Caching.Cache can be used with Winforms, just get a static instance.

See the example below.

With Entlib

 using Microsoft.Practices.EnterpriseLibrary.Caching;
    //Later 
    CacheManager cache= CacheFactory.GetCacheManager(); 
    cache.Add("dataKey", "Yourdata")

With .NET built-in cache - This'll work for your Winform app also.

using System.Web.Caching;
using System.Web;

public sealed class CacheProvider 
{ 
    private CacheProvider(){}; 

    public static GetInstance() 
    {  
            return HttpRuntime.Cache;
    } 
}
amazedsaint
  • 7,642
  • 7
  • 54
  • 83
  • any good tips on not having to decrypt the 100s of .config settings? +1 for the enterprise as well, forgot about that set. – Tom Anderson Dec 24 '08 at 19:04
  • Thanks for the samples, I am going to be investigating the HttpRuntime one especially, already tested it by integrating it a bit into the LinqToSql classes I have, and it is proving quite a resource releaser. – Tom Anderson Dec 24 '08 at 20:20
0

Well, if you have a Windows Forms application, you aren't usually concerned with the types of multi-user caching scenarios that are common in ASP.NET. I think that's why you aren't seeing a lot of documentation on the subject here.

I generally roll my own caching mechanism for Windows Forms -- just storing "cached" stuff as the application's state. Do you have any examples of a scenario where you would need it? The solution should be tailored to fit the problem...

Dave Markle
  • 95,573
  • 20
  • 147
  • 170
0

Velocity is another option.

Kent Boogaart
  • 175,602
  • 35
  • 392
  • 393