Caching In C# Application
-
Is it possible to use Cache in a windows form application? if yes, how do i do that? pls advice...
Sure. But the methods used depend entirely on what your trying to cache. RageInTheMachine9532
-
Sure. But the methods used depend entirely on what your trying to cache. RageInTheMachine9532
Basically values from the database that has been stored into a hashtable... this hashtable will then later be inserted into a cache... i have tried doing it in asp.net by using System.Web; using System.Web.Caching to enable the use of Cache. so now i m actually wondering whether this could be used in a windows form application. can a windows form application call to this cache...?
-
Basically values from the database that has been stored into a hashtable... this hashtable will then later be inserted into a cache... i have tried doing it in asp.net by using System.Web; using System.Web.Caching to enable the use of Cache. so now i m actually wondering whether this could be used in a windows form application. can a windows form application call to this cache...?
Hi, One way is to use the Caching Application Block: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/Cachingblock.asp Marcie http://www.codeproject.com
-
Basically values from the database that has been stored into a hashtable... this hashtable will then later be inserted into a cache... i have tried doing it in asp.net by using System.Web; using System.Web.Caching to enable the use of Cache. so now i m actually wondering whether this could be used in a windows form application. can a windows form application call to this cache...?
You could use the Web.Caching class to do what you want. If your app isn't web based, you might also want to look at this MSDN .NET Caching Guide[^] for some other ideas. RageInTheMachine9532
-
You could use the Web.Caching class to do what you want. If your app isn't web based, you might also want to look at this MSDN .NET Caching Guide[^] for some other ideas. RageInTheMachine9532
Yeah the application that i m doing isn't web based... For web based, i implemented something like this... // Global Declaration private Cache m_Cache; // Constructor m_Cache = HttpRuntime.Cache; // The implementation if ( m_Cache["Sql"] == null ) { /* 1. Get Data To Be Cached From Database Into A DataSet 2. Insert DataSet To HashTable 3. Insert HashTable to m_Cache */ } else { /* Get The Required HashTable From Cache */ } But then for my Windows Forms Application ( Isn't Web Based ), i wanna do it something like how i did it with the HttpRuntime.Cache but then i can't coz i don't wanna use Web.Caching Class. I know that by using Hashtable is already a form of caching, but how do i initialize a Hashtable for a runtime cache? i mean something like this... // Global Declaration private Hashtable m_Hashtable; // Constructor m_Hashtable = HttpRuntime.Cache; // Which is impossible coz i m not using Web.Caching Class. Pls Advice...