打印

[asp] Application缓存的更新。

我有个程序,一个页面要很频繁的读取数据库,每天以千万次计算
现在做成了 Application缓存。
但是读取的这些内容又要不时更新 频率在3分钟
请问我怎么才能 让 Application 每隔 3分钟更新一次啊。

ASP+SQL 的
貌似总得开着个页面。
在地狱里看到天使的影子…
开着页面可以用JS定时异步来更新App.
在地狱里看到天使的影子…
用的时候,比较一下时间差就行……

没人用干嘛要更新它呢……
世界本不公平,何必愤愤不平?-----上班时间断网了……
“心缘地方“同学录 V3.0版!!

TOP

还在为头像烦恼?还在为不能关注好友动态烦忧?快来蓝色理想家园吧!
写入缓存把时间也写进去
如:Application("kelon") = Now()   
然后用DateDiff来对比就可以实现。

TOP

Public Function getAutoRefreshCache(strCacheName)
              Dim arrCache
              arrCache = Application("arcache_" & strCacheName)
              If IsArray(arrCache) = False Then
                     reloadARCache(strCacheName)
              End If
              If arrCache(0) < Now Then
                     reloadARCache(strCacheName)
              End If
              arrCache = Application("arcache_" & strCacheName)
              getAutoRefreshCache = arrCache(1)
       End Function

       Public Sub reloadARCache(strCacheName)
              Dim arrCache(2)
              Dim sExpiresTime
              arrCache(1) = Eval("create_" & strCachename & "(sExpiresTime)")
              arrCache(0) = sExpiresTime
              Application("arcache_" & strCacheName) = arrCache
       End Sub
你风流,我俊雅,和你同年少,两情深,罚下愿,再不去跳槽。

TOP