CACHING using asp.net

123 Views Asked by At

I am using vb.net and asp.net. My web application is used by multiple parallel users . I have a table named "Tracked_Table"

I want to cache this table for 10 seconds and after 10 seconds, i wanted to reload the cache again with the latest "Tracked_Table" data.

I have tried on the Below code.. (ASP.NET AND VB.NET)

-- In page Load:

If Cache("tracked") Is Nothing Then
    FillCache()
ElseIf (DateTime.Now() - Convert.ToDateTime(Cache("timestamp"))).TotalSeconds > 10 Then
    FillCache()
End If

DisplayTrackedTable() ' --Here i am using the Cache("tracked") table..

-- End of pageload

In the Fillcache function , the below code i hv written.

** vehicleTrackedDict --> The dictionary containing the "tracked_table" data

Cache.Remove("tracked")
Cache.Remove("timestamp")
Cache("timestamp") = Now.ToString("yyyy/MM/dd HH:mm:ss")
Cache("tracked") = vehicleTrackedDict

This is the whole thing i am trying to use cache..

But this code seems to be not working perfectly for Parallel multiple users.

Can any one helps me out for this..

0

There are 0 best solutions below