HttpResponse.AddCacheDependency メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HttpResponse.AddCacheDependency メソッドの意味・解説 

HttpResponse.AddCacheDependency メソッド

メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。

応答が出力キャッシュに格納されていて、指定した依存関係が変化した場合、キャッシュ依存関係のセットを応答に関連付け、応答を効率的に無効化します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub AddCacheDependency ( _
    ParamArray dependencies As CacheDependency()
 _
)
Dim instance As HttpResponse
Dim dependencies As CacheDependency()

instance.AddCacheDependency(dependencies)
public void AddCacheDependency (
    params CacheDependency[] dependencies
)
public:
void AddCacheDependency (
    ... array<CacheDependency^>^ dependencies
)
public void AddCacheDependency (
    CacheDependency[] dependencies
)
public function AddCacheDependency (
    ... dependencies : CacheDependency[]
)

パラメータ

dependencies

アプリケーション依存関係のリストに追加するファイル、キャッシュ キー、または CacheDependency。

解説解説

AddCacheDependency メソッドを使用すると、キャッシュされた応答と CacheDependency オブジェクトとの間の依存関係を作成できます。

使用例使用例

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>
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

HttpResponse.AddCacheDependency メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HttpResponse.AddCacheDependency メソッドのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS