网络编程 
首页 > 网络编程 > 浏览文章

asp自带的内存缓存 application

(编辑:jimmy 日期: 2024/5/9 浏览:3 次 )
函数getcache,会自动建立需要的缓存。
复制代码 代码如下:
Function getcache(funsname,isreset,isarr,timeinfo)
‘funsname — 需要缓存的内容,这里要输入一个function名
‘isreset –是否更新[值:0(根据时间或判断缓存为空时自动更新)、1(主动更新)]
‘ isarr —- 所缓存的内容是否为一个数据[0为字符串,1为数组]
‘ timeinfo —- 缓存更新时间,单位为秒,当值为0时,则只在缓存为空时,才更新
dim domain = “cnzhaopin.com.cn”
Dim temp_getconfig
Dim re_getcache : re_getcache = False
Dim temp_isarray_type : temp_isarray_type = False
Dim Appfunsname : Appfunsname = Replace(Replace(Replace(funsname,”(”,”"),”)”,”"),”,”,”.”)
If isarr = 1 Then temp_isarray_type = True
If isreset = 1 Then re_getcache = True
If isreset = 2 Then
execute(”temp_getconfig=”&funsname)
getcache = temp_getconfig
Exit Function
End If
If Application(domain&”_”&Appfunsname&”_time”) = “” And timeinfo<>0 Then re_getcache = True
If Not re_getcache Then
If temp_isarray_type Then
If Not IsArray(Application(domain&”_”&Appfunsname)) Then re_getcache = True
Else
If Application(domain&”_”&Appfunsname) = “” Then re_getcache = True
End If
End If
If Not re_getcache And timeinfo<>0 Then
If Int(DateDiff(”s”,Application(domain&”_”&Appfunsname&”_time”),now()))>timeinfo Then re_getcache = True
End If
If re_getcache Then
execute(”temp_getconfig=”&funsname)
Application.Lock
Application(domain&”_”&Appfunsname) = temp_getconfig
Application(domain&”_”&Appfunsname&”_time”) = Now()
Application.UnLock
Else
temp_getconfig=Application(domain&”_”&Appfunsname)
End If
getcache = temp_getconfig
End Function


使用时:

复制代码 代码如下:
Function output3
output3=”"
set newrs=conn.execute(”select TOP 60 companyname,comid,vipdata,ishot from company where isok=1 and vipqx>60 and vipqx<300 and vip=1 and comid in (select comid from jobs where zt<>1) order by newid()”)
do while not newrs.eof
output3=output3 & “……….”
newrs.movenext
loop
newrs.close
set newrs=nothing
End function
response.write getcache(”output3″,0,0,3600)
上一篇:Cookies 欺骗漏洞的防范方法(vbs+js 实现)
下一篇:ASP读取XML实例 优酷专辑采集程序 雷锋版
一句话新闻
高通与谷歌联手!首款骁龙PC优化Chrome浏览器发布
高通和谷歌日前宣布,推出首次面向搭载骁龙的Windows PC的优化版Chrome浏览器。
在对骁龙X Elite参考设计的初步测试中,全新的Chrome浏览器在Speedometer 2.1基准测试中实现了显著的性能提升。
预计在2024年年中之前,搭载骁龙X Elite计算平台的PC将面世。该浏览器的提前问世,有助于骁龙PC问世就获得满血表现。
谷歌高级副总裁Hiroshi Lockheimer表示,此次与高通的合作将有助于确保Chrome用户在当前ARM兼容的PC上获得最佳的浏览体验。
友情链接:杰晶网络 DDR爱好者之家 南强小屋 黑松山资源网 白云城资源网