<!--#include file="inc/function.asp"-->
<!--#include file="inc/config.asp"-->
<%
'Secs是每次要刷新数据的时间, retVal是数据,datVal是剩余时间
'retVal = Application("cache_weatherhn") '取得appliction的值
datVal = Application("cache_weatherhn_date") '取得appliction的值
'判断datVal 的值,也就是要计算时间过去了没
If datVal = "" Then
'如果是空,datVal值为当前时间按秒加上secs定义的时间
datVal = DateAdd("s",Secs,Now)
Application("cache_weatherhn_date")= DateAdd("s",Secs,Now)
End If
'temp1是判断当前时间和datVal的秒差
temp1 = DateDiff("s", Now, datVal)
'如果retVal已经是上面函数的返回值且时间大于0 
'If temp1 > 0 And retVal <> "" Then 
If temp1 > 0 Then '如是时间没有过期则跳转到静态页
'本函数返回记录数
'DisplayCachedRecords = retVal
response.Write( "<frameset><frame src=""hn.htm""></frameset>")
Response.Write "<b><font color=""green"">利用缓存读取数据"
Response.Write " ... (" & temp1 & " 秒剩余)</font></b>"
Response.Write "<br><br>"

Else
'retVal 是空的话,就赋予DisplayRecords的值给变量temp2
'Dim temp2
'temp2 = DisplayRecords()
'保存到Application.------------------>重点
Application.Lock
'Application("cache_weatherhn") = temp2
Application("cache_weatherhn_date") = DateAdd("s",Secs,Now)
Application.UnLock
Url="http://weather.265.com/hn.htm"
wstr = GetPage(Url)
'==============================================
wstr=replace(wstr,"<a href=""http://www.265.com/Lvyou_Ditu/#377"" target=""_blank"">点击进入：世界各地天气预报及各大城市气象台</a>","")
wstr=replace(wstr,"265.com",siteurl)
wstr=replace(wstr,"265上网导航",sitename&"-天气预报")
wstr=replace(wstr,"index.htm","default.asp")
wstr=replace(wstr,"hd.htm","hd.asp")
wstr=replace(wstr,"hn.htm","hn.asp")
wstr=replace(wstr,"hz.htm","hz.asp")
wstr=replace(wstr,"db.htm","db.asp")
wstr=replace(wstr,"xb.htm","xb.asp")
wstr=replace(wstr,"xn.htm","xn.asp")
wstr=replace(wstr,"ga.htm","ga.asp")
wstr=replace(wstr,"265主页",sitename&"主页")
'==============================================
Set fs=Server.CreateObject("Scripting.FileSystemObject")
If (fs.FileExists(server.MapPath("./")&"\hn.htm")) Then
fs.DeleteFile(server.MapPath("./")&"\hn.htm")
End If

Set CrFi=fs.CreateTextFile(server.MapPath("./")&"\hn.htm")
Crfi.Writeline(wstr)
set CrFi=nothing
set fs=nothing
'DisplayCachedRecords = temp2
response.Write( "<frameset><frame src=""hn.htm""></frameset>")
'这里随便写上了记录的缓存的过去时间,相对总秒数倒差 :
response.Write "<b><font color=""red"">刷新缓存显示 ..."
Response.Write "</font></b><br><br>"
End If

%>