3月9
funsname ---- 需要缓存的内容
<%
'***********************************************
'函数名:getcache
'作 用:内容缓存
'作 者: hayden
'时 间: 2007-12-21
'参 数:funsname ---- 需要缓存的内容
' &nbsp; isreset ---- 是否更新[值:0(根据时间或判断缓存为空时自动更新)、1(主动更新)]
' isarr ---- 所缓存的内容是否为一个数据[0为字符串,1为数组]
' timeinfo ---- 缓存更新时间,单位为秒,当值为0时,则只在缓存为空时,才更新
'***********************************************
Function getcache(funsname,isreset,isarr,timeinfo)
Dim temp_getconfig
Dim re_getcache : re_getcache = False
Dim temp_isarray_type : temp_isarray_type = false
If isarr = 1 Then temp_isarray_type = True
If isreset = 1 Then re_getcache = True
If Application(domain&"_"&funsname&"_time") = "" And timeinfo<>0 Then re_getcache = True
If Not re_getcache Then
If temp_isarray_type Then
If Not IsArray(Application(domain&"_"&funsname)) Then re_getcache = True
Else
If Application(domain&"_"&funsname) = "" Then re_getcache = True
End If
End If
If Not re_getcache And timeinfo<>0 Then
If Int(DateDiff("s",Application(domain&"_"&funsname&"_time"),now()))>timeinfo Then re_getcache = True
End If
If re_getcache Then
execute("temp_getconfig="&funsname)
Application.Lock
Application(domain&"_"&funsname) = temp_getconfig
Application(domain&"_"&funsname&"_time") = Now()
Application.UnLock
Else
temp_getconfig=Application(domain&"_"&funsname)
End If
getcache = temp_getconfig
End Function
'****************
'********调用演示:
'****************
Function out_test1 '返回一个字符串的示例函数
out_test1="这里是一个字符串"
End Function
Function out_test2 '返回一个数组的示例函数
Dim temp_out_test2
temp_out_test2="这里.是.一个.数组"
out_test2=Split(temp_out_test2,".")
End Function
Dim i
'数组缓存(将函数out_test1置入缓存)
Dim str2 : str2 = getcache("out_test1",0,0,180) '字符串缓存
response.write str2
response.write "<BR><BR><BR>"
'数组缓存(将函数out_test2置入缓存)
Dim str1 : str1 = getcache("out_test2",0,1,180)
For i = 0 To UBound(str1)
response.write str1(i) & "<BR>"
Next
%>
最后编辑: tommyhu 编辑于2009/04/04 23:39
<%
'***********************************************
'函数名:getcache
'作 用:内容缓存
'作 者: hayden
'时 间: 2007-12-21
'参 数:funsname ---- 需要缓存的内容
' &nbsp; isreset ---- 是否更新[值:0(根据时间或判断缓存为空时自动更新)、1(主动更新)]
' isarr ---- 所缓存的内容是否为一个数据[0为字符串,1为数组]
' timeinfo ---- 缓存更新时间,单位为秒,当值为0时,则只在缓存为空时,才更新
'***********************************************
Function getcache(funsname,isreset,isarr,timeinfo)
Dim temp_getconfig
Dim re_getcache : re_getcache = False
Dim temp_isarray_type : temp_isarray_type = false
If isarr = 1 Then temp_isarray_type = True
If isreset = 1 Then re_getcache = True
If Application(domain&"_"&funsname&"_time") = "" And timeinfo<>0 Then re_getcache = True
If Not re_getcache Then
If temp_isarray_type Then
If Not IsArray(Application(domain&"_"&funsname)) Then re_getcache = True
Else
If Application(domain&"_"&funsname) = "" Then re_getcache = True
End If
End If
If Not re_getcache And timeinfo<>0 Then
If Int(DateDiff("s",Application(domain&"_"&funsname&"_time"),now()))>timeinfo Then re_getcache = True
End If
If re_getcache Then
execute("temp_getconfig="&funsname)
Application.Lock
Application(domain&"_"&funsname) = temp_getconfig
Application(domain&"_"&funsname&"_time") = Now()
Application.UnLock
Else
temp_getconfig=Application(domain&"_"&funsname)
End If
getcache = temp_getconfig
End Function
'****************
'********调用演示:
'****************
Function out_test1 '返回一个字符串的示例函数
out_test1="这里是一个字符串"
End Function
Function out_test2 '返回一个数组的示例函数
Dim temp_out_test2
temp_out_test2="这里.是.一个.数组"
out_test2=Split(temp_out_test2,".")
End Function
Dim i
'数组缓存(将函数out_test1置入缓存)
Dim str2 : str2 = getcache("out_test1",0,0,180) '字符串缓存
response.write str2
response.write "<BR><BR><BR>"
'数组缓存(将函数out_test2置入缓存)
Dim str1 : str1 = getcache("out_test2",0,1,180)
For i = 0 To UBound(str1)
response.write str1(i) & "<BR>"
Next
%>
最后编辑: tommyhu 编辑于2009/04/04 23:39
tommyhuc.cn网友
2012/02/02 23:45
祝楼主和各网友龙年里平安、健康、快乐 !
tommyhuc.cn网友
2012/01/17 04:22
太好了!!!谢谢分享啊!!!顶顶!!
分页: 1/1
1
1

精典ASP遍历文件文件夹(ASP遍历)
测试电脑上所有盘信息的源码





