HttpResponse.AddCacheDependency メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim instance As HttpResponse Dim dependencies As CacheDependency() instance.AddCacheDependency(dependencies)


AddCacheDependency メソッドと CacheDependency オブジェクトを使用してキャッシュ依存関係を作成する方法を次のコード例に示します。
<%@ Page Language="VB" %> <%@ outputcache duration="30" varybyparam="none" %> <script runat="Server"> Sub Page_Load() ' Create a Cache Dependency ' using a CacheDependency object. Dim authorsDependency("authors.xml") As CacheDependency ' Make the page invalid if either of the ' cached items change or expire. Response.AddCacheDependency(authorsDependency) ' Display the current time for cache reference lblOutputCacheMsg.Text = DateTime.Now.ToString() End Sub </script> <html> <head> <title>Cache Dependencies</title> </head> <body> <form id="Form1" method="post" runat="server"> <table> <tbody> <tr> <td style="WIDTH: 118px"> The page was generated at:</td> <td> <asp:Label id="lblOutputCacheMsg" runat="server"></asp:Label> </td> </tr> </tbody> </table> </form> </body> </html>
<%@ Page Language="C#" %> <%@ outputcache duration="30" varybyparam="none" %> <script runat="Server"> private void Page_Load(object sender, System.EventArgs e) { // Create a Cache Dependency // using a CacheDependency object. CacheDependency authorsDependency = new CacheDependency("authors.xml"); // Make the page invalid if either of the // cached items change or expire. Response.AddCacheDependency(authorsDependency); // Display the current time for cache reference lblOutputCacheMsg.Text = DateTime.Now.ToString(); } </script> <html> <head> <title>Cache Dependencies</title> </head> <body> <form id="Form1" method="post" runat="server"> <table> <tbody> <tr> <td style="WIDTH: 118px"> The page was generated at:</td> <td> <asp:Label id="lblOutputCacheMsg" runat="server"></asp:Label> </td> </tr> </tbody> </table> </form> </body> </html>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- HttpResponse.AddCacheDependency メソッドのページへのリンク