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.

另请参阅