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

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

VirtualPathProvider.GetCacheDependency メソッド

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

指定した仮想パスに基づいてキャッシュの依存関係を作成します。

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

Public Overridable Function
 GetCacheDependency ( _
    virtualPath As String, _
    virtualPathDependencies As IEnumerable, _
    utcStart As DateTime _
) As CacheDependency
Dim instance As VirtualPathProvider
Dim virtualPath As String
Dim virtualPathDependencies As IEnumerable
Dim utcStart As DateTime
Dim returnValue As CacheDependency

returnValue = instance.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart)
public virtual CacheDependency GetCacheDependency (
    string virtualPath,
    IEnumerable virtualPathDependencies,
    DateTime utcStart
)
public:
virtual CacheDependency^ GetCacheDependency (
    String^ virtualPath, 
    IEnumerable^ virtualPathDependencies, 
    DateTime utcStart
)
public CacheDependency GetCacheDependency (
    String virtualPath, 
    IEnumerable virtualPathDependencies, 
    DateTime utcStart
)
public function GetCacheDependency (
    virtualPath : String, 
    virtualPathDependencies : IEnumerable, 
    utcStart : DateTime
) : CacheDependency

パラメータ

virtualPath

プライマリ想リソースへのパス。

virtualPathDependencies

プライマリ仮想リソースで必要な他のリソースへのパスの配列。

utcStart

仮想リソースが読み取られた UTC 時刻。

戻り値
指定した仮想リソースの CacheDependency オブジェクト。

解説解説

GetCacheDependency メソッドの既定の実装では null 参照 (Visual Basic では Nothing) を返します。後で使用できるように仮想リソースをキャッシュするには、GetCacheDependency メソッドまたは GetFileHash メソッドをオーバーライドする必要があります。

使用例使用例

VirtualPathProvider カスタム クラスの GetCacheDependency メソッドの実装例を次のコード例に示します。例の実行に必要なコード全体については、VirtualPathProvider クラスの概要のトピックで「例」を参照してください。

Public Overrides Function
 GetCacheDependency(ByVal virtualPath As String,
 ByVal virtualPathDependencies As IEnumerable, ByVal utcStart As Date)
 As CacheDependency
  If (IsPathVirtual(virtualPath)) Then

    Dim fullPathDependencies As System.Collections.Specialized.StringCollection
    fullPathDependencies = Nothing

    ' Get the full path to all dependencies.
    For Each virtualDependency As
 String In virtualPathDependencies
      If fullPathDependencies Is Nothing
 Then
        fullPathDependencies = New System.Collections.Specialized.StringCollection
      End If

      fullPathDependencies.Add(virtualDependency)
    Next

    If fullPathDependencies Is Nothing
 Then
      Return Nothing
    End If

    Dim fullPathDependenciesArray As String()
    fullPathDependencies.CopyTo(fullPathDependenciesArray, 0)

    Return New CacheDependency(fullPathDependenciesArray,
 utcStart)
  Else
    Return Previous.GetCacheDependency(virtualPath, virtualPathDependencies,
 utcStart)
  End If
End Function
public override CacheDependency GetCacheDependency(
  string virtualPath, 
  System.Collections.IEnumerable virtualPathDependencies, 
  DateTime utcStart)
{
  if (IsPathVirtual(virtualPath))
  {
    System.Collections.Specialized.StringCollection fullPathDependencies = null;

    // Get the full path to all dependencies.
    foreach (string virtualDependency in
 virtualPathDependencies)
    {
      if (fullPathDependencies == null)
        fullPathDependencies = new System.Collections.Specialized.StringCollection();

      fullPathDependencies.Add(virtualDependency);
    }
    if (fullPathDependencies == null)
      return null;

    // Copy the list of full-path dependencies into an array.
    string[] fullPathDependenciesArray = new
 string[fullPathDependencies.Count];
    fullPathDependencies.CopyTo(fullPathDependenciesArray, 0);
    // Copy the virtual path into an array.
    string[] virtualPathArray = new string[1];
    virtualPathArray[0] = virtualPath;

    return new CacheDependency(virtualPathArray,
 fullPathDependenciesArray, utcStart);
  }
  else
    return Previous.GetCacheDependency(virtualPath, virtualPathDependencies,
 utcStart);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
VirtualPathProvider クラス
VirtualPathProvider メンバ
System.Web.Hosting 名前空間



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

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

   

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



VirtualPathProvider.GetCacheDependency メソッドのページの著作権

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

©2026 GRAS Group, Inc.RSS