System.Runtime.Caching 命名空間

System.Runtime.Caching 命名空間包含型別,可讓您實作 .NET Framework 應用程式中的快取。 The System.Runtime.Caching namespace contains types that let you implement caching in NET Framework applications.

類別

CacheEntryChangeMonitor

提供表示 ChangeMonitor 型別的基底類別,可實作這個型別以監控快取項目的變更。Provides a base class that represents a ChangeMonitor type that can be implemented in order to monitor changes to cache entries.

CacheEntryRemovedArguments

提供已經從快取區中移除之快取項目的相關資訊。Provides information about a cache entry that was removed from the cache.

CacheEntryUpdateArguments

提供即將從快取區中移除之快取項目的相關資訊。Provides information about a cache entry that will be removed from the cache.

CacheItem

表示快取區中的個別快取項目。Represents an individual cache entry in the cache.

CacheItemPolicy

表示特定快取項目的一組收回和期限詳細資料。Represents a set of eviction and expiration details for a specific cache entry.

ChangeMonitor

提供衍生之自訂型別的基底類別,這個型別會監控快取項目所依存之資料的狀態變更。Provides a base class for a derived custom type that monitors changes in the state of the data which a cache item depends on.

FileChangeMonitor

表示監控檔案變更的物件。Represents an object that monitors changes to files.

HostFileChangeMonitor

監控目錄和檔案路徑,並通知快取受監控項目發生變更的資訊。Monitors directories and file paths and notifies the cache of changes to the monitored items. 這個類別無法被繼承。This class cannot be inherited.

MemoryCache

表示可實作記憶體內部快取的型別。Represents the type that implements an in-memory cache.

ObjectCache

表示物件快取,並提供存取物件快取所需的基底方法和屬性。Represents an object cache and provides the base methods and properties for accessing the object cache.

SqlChangeMonitor

為 SQL Server 資料庫提供變更監視。Provides change monitoring for SQL Server databases. 這個類別無法被繼承。This class cannot be inherited.

列舉

CacheEntryRemovedReason

指定快取項目被移除或即將被移除的原因。Specifies the reason why a cache entry was removed or an entry is about to be removed.

CacheItemPriority

指定用來決定是否應該清除快取項目的優先權設定。Specifies a priority setting that is used to decide whether to evict a cache entry.

DefaultCacheCapabilities

代表快取實作提供的一組功能。Represents a set of features that a cache implementation provides.

委派

CacheEntryRemovedCallback

定義方法的參考,移除快取區中的快取項目後會呼叫該方法。Defines a reference to a method that is called after a cache entry is removed from the cache.

CacheEntryUpdateCallback

定義方法的參考,這個方法會在即將移除快取區中的快取項目時叫用。Defines a reference to a method that is invoked when a cache entry is about to be removed from the cache.

OnChangedCallback

定義處理監控項目變更之方法的參考。Defines a reference to a method that handles changes to monitored items.

備註

這個命名空間中的類別提供如同在 ASP.NET 中使用快取設備的方式,但是不需要在 System.Web 組件上的相依性。The classes in this namespace provide a way to use caching facilities like those in ASP.NET, but without a dependency on the System.Web assembly.

注意

輸出快取功能與中的型別System.Runtime.Caching命名空間中導入.NET Framework 4.NET Framework 4The output caching functionality and types in the System.Runtime.Caching namespace were introduced in .NET Framework 4.NET Framework 4.

這個命名空間中提供的快取類型提供了下列功能:The caching types that are provided in this namespace offer the following features:

  • 所有的.NET Framework 應用程式 (不只是 ASP.NET) 來存取快取。Caching is accessible to all .NET Framework applications (not just ASP.NET).

  • 快取是可延伸的。Caching is extensible.

  • 您可以建立自訂快取提供者。You can create custom caching providers. 比方說,而不是使用預設的記憶體中快取引擎,您可以建立快取資料儲存在資料庫、 自訂物件,或在檔案系統中的自訂提供者。For example, instead of using the default in-memory cache engine, you can create custom providers that store cache data in databases, in custom objects, or in the file system.

另請參閱