国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

asp自帶的內存緩存 application

2024-05-04 11:06:50
字體:
來源:轉載
供稿:網友

asp強大的application 是 php 中所沒有的。昨天朋友抱怨他的人才網站讀取速度慢,于是我幫他把asp中讀庫比較費時的部分用application做了緩存。

函數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)
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 读书| 郎溪县| 高要市| 丁青县| 寻乌县| 平谷区| 山东省| 措美县| 册亨县| 板桥市| 苍南县| 衡阳市| 衡阳县| 云龙县| 烟台市| 鄂尔多斯市| 伊春市| 延庆县| 高陵县| 长葛市| 九台市| 马山县| 大厂| 二连浩特市| 巍山| 抚顺县| 福泉市| 岳池县| 尼勒克县| 金堂县| 义乌市| 深泽县| 闽侯县| 彩票| 巨野县| 津市市| 日土县| 延庆县| 卓尼县| 卓尼县| 名山县|