Caching with ASP.NET
ASP.NET supports three types of caching for Web-based applications:
- Page Level Caching (called Output Caching)
- Page Fragment Caching (often called Partial-Page Output Caching)
- Programmatic or Data Caching
Private Sub Fill()
Dim dv As DataView = DirectCast(Cache("myobj"), DataView)
Dim ds As New DataSet
If dv Is Nothing Then
Dim sql As String = "SP_GET_Records"
ds = FillDS(sql)
dv = ds.Tables(0).DefaultView
Cache("myobj") = dv
End If
DataList1.DataSource = dv
DataList1.DataBind()
End Sub
Public Function FillDS(ByVal sql As String) As DataSet
Dim con As New SqlConnection(myConStr)
Dim da As New SqlDataAdapter(sql, con)Dim ds As New DataSet
da.Fill(ds)
con.Close()
Return ds
End Function