ASP's powerful Application is not in PHP. Yesterday, my friend complained that his talent website was slow to read, so I helped him use the Application part of the ASP to read the more timely part of the ASP.
Function Getcache will automatically establish the required cache.
Function getcache (funname, isreset, isarr, timeInfo))
'Funsname -I need to cache content, here is a fan that needs to be entered.
'isreset -Whether to update [Value: 0 (based on time or judgment cache to automatically update when it is empty), 1 (active update)]
'Isarr-whether the content of the cache is a data [0 is a string, 1 is an array]
'TimeInfo-cache update time, the unit is second, when the value is 0, it is only updated when the cache is empty
dim domain = cnzhaopin.com.cn
DIM TEMP_getConfig
DIM Re_getCache: Re_getCache = false
DIM TEMP_ISARAY_TYPE: TEMP_ISARRAY_TYPE = false
Dim appfunsname: appfunsname = replace (replace (replace (funsname, (,),),) ,,,,,,,,,
If isarr = 1 then temp_isarray_type = true
If isreset = 1 the 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 (datingiff (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
When used:
Function output3
output3 =
set newrs = const.execute (Select Top 60 CompanyName, Comid, VIPDATA, ISHOT FROM Company WHERE ISOK = 1 and VIPQX> 60 and VIPQX <300 and VIP = 1 and Comp that Comid from jobs where zt <> 1) Order by newid ())
do while not newrs.eof
OUTPUT3 = OUTPUT3 & ............
newrs.movenext
loop
newrs.close
set news = nothing
End function
Response.write getcache (output3 ″, 0,0,3600)