| Dim retVal, datVal, temp1 retVal = Application("cache_demo") datVal = Application("cache_demo_date") If datVal = "" Then datVal = DateAdd("s",Secs,Now) End If temp1 = DateDiff("s", Now, datVal) If temp1 > 0 And retVal <> "" Then DisplayCachedRecords = retVal Response.Write "<b><font color=""green"">利用缓存读取数据" Response.Write " ... (" & temp1 & " 秒剩余)</font></b>" Response.Write "<br><br>" Else Dim temp2 temp2 = DisplayRecords() Application.Lock Application("cache_demo") = temp2 Application("cache_demo_date") = DateAdd("s",Secs,Now) Application.UnLock
DisplayCachedRecords = temp2 Response.Write "<b><font color=""red"">刷新缓存显示 ..." Response.Write "</font></b><br><br>" End If End Function %>
调用方法:
<%=DisplayCachedRecords(20)%> 写在后面的话:假如你感觉你的服务器内存不够大的话,不要大量使用缓存.
|
| 共3页: 上一页 [1] [2] 3 下一页 |
评论加载中…