In order to improve the performance of Asp programs, people often use cached data frequently in applications. This article is about teaching you to cache and improve the performance of Asp programs by the editor of the False New Technology Channel. I hope it will be helpful for you to learn this knowledge!
Teach you how to cache and improve the performance of Asp programs
<%
Class wawa_app_getrows
public Function wawa_Get_List(strapp,strconn,strsql)
'************************************
'Function: Extract an array from the Application. If the data in the application is an empty value, then call the wawa_Get_Rows() function to assign a value to the application.
' , You can clear the corresponding application value into empty when modifying the database, and the application will be automatically updated when browsing.
'If you update the database (such as adding, modifying or deleting data), then remove the corresponding application variable after modifying the database.
' Use the following statement to clear the specified application value, where the strapp parameter is the name of the application variable to be removed
' application.Contents.Remove(strapp)
' www.knowsky.com
'************************************
Dim wawa
wawa = Application(strapp)
If isempty(wawa) Then
wawa = wawa_Get_Rows(strconn,strsql)
Application(strapp) = wawa
End If
wawa_Get_List = wawa
End Function
public Function wawa_Get_Rows(strconn,strsql)
'************************************
'Function: Read records from the database and use the getrows method
' Save the record into an array
'
'************************************
Dim rs_wawa
Set rs_wawa = CreateObject("ADODB.Recordset")
rs_wawa.Open strsql,strconn,1,1
wawa_Get_Rows = rs_wawa.GetRows()
rs_wawa.Close
Set rs_wawa = Nothing
End Function
End Class
%>
<%
dim strapp, strsql, strconn
strapp="xinwendongtai"
strsql="select top 5 id,title from wen where lei=161 order by id desc"
strconn="Driver={sql server};server=192.168.0.110;database=new;uid=sa;pwd=sa;"
set wawa_temp=new wawa_app_getrows
arr_xinwendongtai=wawa_temp.wawa_Get_LIst(strapp,strconn,strsql)
%>
<% If ubund(arr_xinwendongtai)<>0 Then %>
<% for i=0 to ubund(arr_xinwendongtai,2)-1 %>
<% next %>
<% Else %>
<% End If %>
The above article teaches you how to cache and improve the performance of Asp programs. I believe everyone has a certain understanding. If you want to know more technical information, please continue to pay attention to the wrong new technology channel!