Sub CheckCache
Dim CacheErr
CacheErr = True
'检查是否第一次访问
If IsDate(Application("UpdateTime")) Then
If DateDiff("s",Now,Application("UpdateTime"))>0 Then
'缓存未过期
CacheErr=False
End If
End If
If CacheErr Then Call UpdateCache
End Sub
Sub UpdateCache
'赋值过期时间,TimeOut是每隔多少秒过期
Const TimeOut = 600
Application("UpdateTime") = DateAdd("n",TimeOut,Now)
'更新首页
...
End Sub