I have a method, in a class, for retrieving some data from mssql database. I use this in many pages and web handlers depending on user's permission. I don't always want get data from database and need to use the advantage of caching. I am using vb.net framework 2 as my client and don't want to change it. I tried in many ways, but it didn't work. Can anyone help me...
My last try was this:
Dim myDataSet As New DataSet
myDataSet = CType(Web.HttpContext.Current.Cache.Get("myData"), DataSet)
If myDataSet Is Nothing Then
myDataSet = GetData("select * from Table")
Web.HttpContext.Current.Cache.Insert("myData", myDataSet, Nothing, DateTime.Now.AddSeconds(60), TimeSpan.Zero)
'End If
End If
This is one of the methods from a class (testClass.vb), Any suggestions please...