<%@ 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)
myMessage.Text = DateTime.Now()
End Sub
Sub Button1_Click(sender As Object, e As EventArgs)
Cache("Key1") = "foo"
End Sub
Sub Button2_Click(sender As Object, e As EventArgs)
Cache("Key2") = "bar"
End Sub
</script>
</head>
<body>
<form runat="server">
<asp:label id="myMessage" 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>
|