Adding cache dependencies (VB.net)
<%@ Page Language="vb" %>
<%@ OutputCache Duration="300" VaryByParam="None" %>
<html>
<head>
<title>Adding cache dependencies in ASP.NET</title>
<script runat="server">
Sub Page_Load()
Dim myArrayList As New ArrayList
myArrayList.Add("Key1")
myArrayList.Add("Key2")
Response.AddCacheItemDependencies(myArrayList)
Message.Text = DateTime.Now()
End Sub
Sub Button1_Click(sender As Object, e As EventArgs)
Cache("Key1") = "value for key1"
End Sub
Sub Button2_Click(sender As Object, e As EventArgs)
Cache("Key2") = "value for key2"
End Sub
</script>
</head>
<body>
<form runat="server">
<asp:label id="Message" runat="server"/>
<asp:button id="Button1" text="Change Key 1" onClick="Button1_Click" runat="server"/>
<asp:button id="Button2" text="Change Key 2" onClick="Button2_Click" runat="server"/>
</form>
</body>
</html>
Related examples in the same category