使用asp.net将缓存应用于表 [英] applying cache to a Table using asp.net
问题描述
我正在使用vb.net和asp.net。我的Web应用程序由多个并行用户使用。我有一个名为Tracked_Table的表
我想将此表缓存10秒,10秒后,我想再次使用最新的Tracked_Table重新加载缓存数据。
我试过下面的代码..(ASP.NET和VB.NET)
- 页面加载:
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()' - 我在使用缓存(跟踪)表...
- 页面加载结束
在Fillcache函数中,我写的代码如下。
** vehicleTrackedDict - >包含tracked_table数据的字典
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
这是整件事我想尝试使用缓存..
但这个代码对于Parallel多用户来说似乎并不完美。
任何人都可以帮我解决这个问题..
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..
推荐答案
您好,
请参阅此链接 - 缓存
这篇关于使用asp.net将缓存应用于表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!