t;" Then
CacheData=Application(CacheName&"_"&LocalCacheName)
If IsArray(CacheData) Then
Value=CacheData(0)
Else
Err.Raise vbObjectError + 1, "DvbbsCacheServer", " The CacheData Is Empty."
End If
Else
Err.Raise vbObjectError + 1, "DvbbsCacheServer", " please change the CacheName."
End If
End Property
Public Function ObjIsEmpty()
ObjIsEmpty=True
CacheData=Application(CacheName&"_"&LocalCacheName)
If Not IsArray(CacheData) Then Exit Function
If Not IsDate(CacheData(1)) Then Exit Function
If DateDiff("s",CDate(CacheData(1)),Now()) < 60*Reloadtime Then
ObjIsEmpty=False
End If
End Function
Public Sub DelCahe(MyCaheName)
makeEmpty(CacheName&"_"&MyCaheName)
End Sub
End Class
Dim strconn,rs
strconn="Driver={sql server};server=localhost;database=northwind;uid=sa;pwd=sa;"
Public Function GetEmployees()
Dim SQL,Rs,Cache
Set Cache=New Cls_Cache
Cache.Reloadtime=0.5
Cache.CacheName="wawa"
Cache.Name="Employees"
If Cache.ObjIsEmpty() Then
Set rs=Server.CreateObject("ADODB.Recordset")
SQL = "select EmployeeID, LastName, FirstName from employees order by employeeid desc"
Rs.Open SQL,strconn,1,1
Cache.value = Rs.GetRows(5)
Rs.Close:Set Rs=Nothing
End If
GetEmployees=Cache.Value
Set Cache=Nothing
End Function
ShowRsArr(GetEmpLoyees)
%>
<script>
function TimeOut(a){
var c=a-1;
if(c==0) {
window.location.href=window.location;
}else{
document.all.abc.innerHTML="离缓存结束还有:"+c+"秒";
window.setTimeout(''TimeOut(''+c+'')'',1000);
}
}
</script>
<body onload="TimeOut(''30'')">
<div id="abc"></div>