最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
asp缓存技术
时间:2008-04-22 编辑:简简单单 来源:一聚教程网
<%
function readdb()
Dim objconn,objrs
set objconn=server.createobject("ADODB.Connection")
objconn.connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;" &_
"Data Source=" & server.mappath("db.mdb")
objconn.open
set objrs=server.createobject("ADODB.Recordset")
objrs.open "admin",objconn,1,2,2
temp=""
temp=temp&"
temp=temp&"
ID | "szd_f | "szd_t |
" & objrs("id") & " | "" & objrs("szd_f") & " | "" & objrs("szd_t") & " |
readdb=temp
End function
function readcache(secs)
Dim temp1,temp2,cachedata,cachedate
cachedata=application("cachedata")
cachedate=application("cachedate")
if cachedate=Empty then
cachedate=dateadd("s",secs,now)
End if
temp1=datediff("s",now,cachedate)
if temp1>0 and cachedata<>Empty then
temp2=application("cachedata")
Response.write "
读取缓存数据,离刷新时间还有" & temp1 & "秒
"else
application.lock
application("cachedata")=readdb()
application("cachedate")=dateadd("s",secs,now)
application.unlock
temp2=application("cachedata")
Response.write "
读取数据库数据
"End if
readcache=temp2
End function
%>
asp缓存技术
<% Dim starttime,endtime
starttime=timer
Response.write readcache(20)
endtime=timer
Response.write "
页面运行时间为:" & round((endtime-starttime)*1000.0,2) & "ms
"%>
-
上一个: asp提高执行效率
相关文章
- asp 缓存实现教程代码 03-23
- ASP Clear 清除缓存方法 12-01
- ASP缓存技术 01-12
- VBS 批量Ping的项目讲解 09-19
- 如何封装一个Ajax函数介绍 09-16
- ASP实现加法验证码方法 09-16