Hi, I have a public class where i am trying to cache a datatable with key based dependency. My problem is that if i do specify the dependency, i am not able to insert datatable into cache object. I even copied my code into usercontrol, but i got the same results.
What am i doing wrong ? By the way, if i donot specify any dependency, datatable gets inserted into cache object. I want to do this because i want to get settings for different users from the database when they log in. So in each page, instead of hitting database,
if i can cache datatable, i can get the data thus saving database trip. Also i do not want to use session variables. Below is my code: Public Class SecurityFunctions Public Sub SetAppVariables() DependKey(0) = g_numCIID.ToString ' getting the value from a
cookie Dim MyDependency As New CacheDependency(Nothing, DependKey) If Context.Cache("MyData") Is Nothing Then dt = SetGlobalVariables(g_numCIID) If dt.Rows.Count > 0 Then Context.Cache.Insert("MyData", dt, MyDependency) Else GoAway() End If Else dt = CType(Context.Cache("MyData"),
DataTable) End If getValues(dt) End Sub End Class
sauminpatel
Member
124 Points
27 Posts
datatable caching problem
Nov 03, 2003 06:40 PM|LINK