Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions xml/System.Runtime.Caching.Hosting/IApplicationIdentifier.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
</AssemblyInfo>
<Interfaces />
<Docs>
<summary>Defines an identifier for application domains that a cache implementation can use to interact with a host environment.</summary>
<summary>Defines an identifier that a cache implementation can use to interact with a host environment.</summary>
<remarks>
<format type="text/markdown"><![CDATA[

## Remarks
A .NET Framework host environment such as ASP.NET can use the <xref:System.Runtime.Caching.Hosting.IApplicationIdentifier> interface to define strings that identify individual application domains. The host environment implements the <xref:System.Runtime.Caching.Hosting.IApplicationIdentifier> interface. This interface is then available to <xref:System.Runtime.Caching.ObjectCache> implementations through the <xref:System.Runtime.Caching.ObjectCache.Host> property.
A .NET host environment such as ASP.NET can use the <xref:System.Runtime.Caching.Hosting.IApplicationIdentifier> interface to define strings that identify individual application domains. The host environment implements the <xref:System.Runtime.Caching.Hosting.IApplicationIdentifier> interface. This interface is then available to <xref:System.Runtime.Caching.ObjectCache> implementations through the <xref:System.Runtime.Caching.ObjectCache.Host> property.

A cache implementation uses this reference to obtain an identifier for the application domain. In ASP.NET, cache implementations use the application identifier to construct identifiers for cache performance counters. This provides names for performance counter instances that can be distinguished between application domains when multiple application domains are running.
A cache implementation uses this reference to obtain an identifier. In ASP.NET, cache implementations use the application identifier to construct identifiers for cache performance counters.

]]></format>
</remarks>
Expand Down Expand Up @@ -57,9 +57,7 @@
<format type="text/markdown"><![CDATA[

## Remarks
The <xref:System.Runtime.Caching.Hosting.IApplicationIdentifier.GetApplicationId*> method is typically implemented by a .NET Framework host environment in order to construct an application identifier for an <xref:System.Runtime.Caching.ObjectCache> implementation. A <xref:System.Runtime.Caching.ObjectCache> implementation uses this information to identify the application domain that is currently running.

For example, in ASP.NET, the cache uses an application identifier to construct identifiers for cache performance counters. The cache calls the <xref:System.Runtime.Caching.Hosting.IApplicationIdentifier.GetApplicationId*> method that is implemented by the host environment and the host returns the identifier. This provides names for performance counter instances that can be distinguished between application domains when multiple application domains are running.
The <xref:System.Runtime.Caching.Hosting.IApplicationIdentifier.GetApplicationId*> method is typically implemented by a .NET host environment in order to construct an application identifier for an <xref:System.Runtime.Caching.ObjectCache> implementation.

]]></format>
</remarks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

The <xref:System.Runtime.Caching.Hosting.IFileChangeNotificationSystem> interface is used internally by the <xref:System.Runtime.Caching.HostFileChangeMonitor> class.

When a cache implementation runs in an ASP.NET application domain, ASP.NET implements an <xref:System.Runtime.Caching.Hosting.IFileChangeNotificationSystem> interface through the <xref:System.Runtime.Caching.ObjectCache.Host> property. The <xref:System.Runtime.Caching.HostFileChangeMonitor> class detects this property and uses the ASP.NET file-change notification system to evict cache entries based on file-change notification.
When a cache implementation runs in an ASP.NET application, ASP.NET implements an <xref:System.Runtime.Caching.Hosting.IFileChangeNotificationSystem> interface through the <xref:System.Runtime.Caching.ObjectCache.Host> property. The <xref:System.Runtime.Caching.HostFileChangeMonitor> class detects this property and uses the ASP.NET file-change notification system to evict cache entries based on file-change notification.

In non-ASP.NET applications, there is no host environment that implements a custom <xref:System.Runtime.Caching.Hosting.IFileChangeNotificationSystem> interface. As a result, the <xref:System.Runtime.Caching.HostFileChangeMonitor> class uses the <xref:System.IO.FileSystemWatcher> class of the CLR.

Expand Down
5 changes: 1 addition & 4 deletions xml/System.Runtime.Caching/ChangeMonitor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,11 @@

Derived <xref:System.Runtime.Caching.ChangeMonitor> classes can be customized to monitor dependency changes for specific different data stores. For example, there are cache implementations for a file system, physical memory, or a database. The <xref:System.Runtime.Caching.ChangeMonitor> class examines changes that occur outside the cache, and then alerts the cache that changes have occurred.

The .NET Framework includes the following classes that derive from <xref:System.Runtime.Caching.ChangeMonitor> class:
.NET includes the following classes that derive from <xref:System.Runtime.Caching.ChangeMonitor> class:

- <xref:System.Runtime.Caching.CacheEntryChangeMonitor>

- <xref:System.Runtime.Caching.FileChangeMonitor>

- <xref:System.Runtime.Caching.HostFileChangeMonitor>

- <xref:System.Runtime.Caching.SqlChangeMonitor>

Each of these classes works with different types of dependencies. For example, the derived <xref:System.Runtime.Caching.FileChangeMonitor> class monitors changes to a cache for file system data (files and folders) that the cache item depends on.
Expand Down
11 changes: 1 addition & 10 deletions xml/System.Runtime.Caching/HostFileChangeMonitor.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,10 @@
For each specified file or directory path, the <xref:System.Runtime.Caching.HostFileChangeMonitor> class triggers a change notification if any of the following changes occur:

- The name of the monitored file or directory changes.

- The specified file or directory did not exist at the time the monitor was created, but was created later. In other words, a file or directory was created in the scope of the monitored items.

- The size of a monitored file changed.

- The contents of a monitored file changed, or the contents of a monitored directory changed.

- The access control list (ACL) of the file or directory was changed.

- The monitored file or directory was deleted.

If too many changes occur for the monitored file or directory at the same time, the <xref:System.Runtime.Caching.HostFileChangeMonitor> instance can lose track of specific changes. In this scenario, the <xref:System.Runtime.Caching.HostFileChangeMonitor> class triggers a change notification. This scenario is more likely to occur when the <xref:System.Runtime.Caching.HostFileChangeMonitor> instance monitors a directory, and many changes occur in the scope of the directory structure in a short period of time.
Expand All @@ -53,17 +48,13 @@
When the <xref:System.Runtime.Caching.HostFileChangeMonitor> class is used in an ASP.NET application, the Windows identity that is used for access to monitored items is the application identity for the ASP.NET application. In other words, the application identity will be one of the following:

- The process identity.

- The configured application identity.

- The UNC credential if the application is running from a UNC share.

When the <xref:System.Runtime.Caching.HostFileChangeMonitor> class is used in a non-ASP.NET application, the <xref:System.IO.FileSystemWatcher> class is used internally to monitor files. As a result, whatever access control list (ACL) applies to a monitored file or directory is applied to the Windows identity of the current thread.

> [!NOTE]
> Callers must have the appropriate level of code access security (CAS) permissions and must have NTFS permissions to all monitored directories and paths.


> Callers must have NTFS permissions to all monitored directories and paths.

## Examples
The following example creates a cache item that uses a <xref:System.Runtime.Caching.HostFileChangeMonitor> object to monitor the state of the source data (which is a file) on the file system. The cache entry is defined using a <xref:System.Runtime.Caching.CacheItemPolicy> object to provide eviction and expiration details for the cache entry.
Expand Down
19 changes: 4 additions & 15 deletions xml/System.Runtime.Caching/MemoryCache.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@
The <xref:System.Runtime.Caching.MemoryCache> class is a concrete implementation of the abstract <xref:System.Runtime.Caching.ObjectCache> class.

> [!NOTE]
> The <xref:System.Runtime.Caching.MemoryCache> class is similar to the ASP.NET <xref:System.Web.Caching.Cache> class. The <xref:System.Runtime.Caching.MemoryCache> class has many properties and methods for accessing the cache that will be familiar to you if you have used the ASP.NET <xref:System.Web.Caching.Cache> class. The main differences between the <xref:System.Web.Caching.Cache> and <xref:System.Runtime.Caching.MemoryCache> classes are that the <xref:System.Runtime.Caching.MemoryCache> class has been changed to make it usable by .NET Framework applications that are not ASP.NET applications. For example, the <xref:System.Runtime.Caching.MemoryCache> class has no dependencies on the `System.Web` assembly. Another difference is that you can create multiple instances of the <xref:System.Runtime.Caching.MemoryCache> class for use in the same application and in the same <xref:System.AppDomain> instance.
> The <xref:System.Runtime.Caching.MemoryCache> class is similar to the ASP.NET <xref:System.Web.Caching.Cache> class. The <xref:System.Runtime.Caching.MemoryCache> class has many properties and methods for accessing the cache that will be familiar to you if you have used the ASP.NET <xref:System.Web.Caching.Cache> class. The main differences between the <xref:System.Web.Caching.Cache> and <xref:System.Runtime.Caching.MemoryCache> classes are that the <xref:System.Runtime.Caching.MemoryCache> class has been changed to make it usable by .NET apps that aren't ASP.NET applications. For example, the <xref:System.Runtime.Caching.MemoryCache> class has no dependencies on the `System.Web` assembly. Another difference is that you can create multiple instances of the <xref:System.Runtime.Caching.MemoryCache> class for use in the same application.

The <xref:System.Runtime.Caching.MemoryCache> class does not allow `null` as a value in the cache. Any attempt to add or change a cache entry with a value of `null` will fail.

The <xref:System.Runtime.Caching.MemoryCache> type does not implement *cache regions*. Therefore, when you call <xref:System.Runtime.Caching.MemoryCache> methods that implement base methods that contain a parameter for regions, do not pass a value for the parameter. The methods that use the region parameter all supply a default `null` value. For example, the <xref:System.Runtime.Caching.MemoryCache.AddOrGetExisting*?displayProperty=nameWithType> method overload has a `regionName` parameter whose default value is `null`.



## Examples
The following example declares a reference to the default memory cache instance. The cache entry uses a <xref:System.Runtime.Caching.CacheItemPolicy> object to provide eviction and expiration details for the cache entry. It also uses a <xref:System.Runtime.Caching.ChangeMonitor> object to monitor the state of the source data (which is a file) on the file system.

Expand Down Expand Up @@ -102,7 +100,6 @@ private void btnGet_Click(object sender, EventArgs e)
</remarks>
<threadsafe>This type is thread safe.</threadsafe>
<altmember cref="T:System.Runtime.Caching.ObjectCache" />
<related type="Article" href="/dotnet/framework/performance/caching-in-net-framework-applications">Caching in .NET Framework Applications</related>
</Docs>
<Members>
<Member MemberName=".ctor">
Expand Down Expand Up @@ -428,15 +425,10 @@ private void btnGet_Click(object sender, EventArgs e)

## Remarks
> [!IMPORTANT]
> In .NET Core and .NET 5.0 and later, the <xref:System.Runtime.Caching.MemoryCache.CacheMemoryLimit> property does not have any effect. The underlying implementation for enforcing this limit is not functional outside of .NET Framework.

In .NET Framework (4.x), if the current instance of the cache exceeds the limit on memory set by the <xref:System.Runtime.Caching.MemoryCache.CacheMemoryLimit> property, the cache implementation removes cache entries. Each cache instance in the application can use the amount of memory that is specified by the <xref:System.Runtime.Caching.MemoryCache.CacheMemoryLimit> property. In .NET Core and later, this property returns the value from configuration or constructor parameters but is not enforced.

You can specify the settings for the <xref:System.Runtime.Caching.MemoryCache.CacheMemoryLimit> property in the application configuration file. Alternatively, they can be passed in the constructor or by a caller when the <xref:System.Runtime.Caching.MemoryCache> instance is initialized.
> The <xref:System.Runtime.Caching.MemoryCache.CacheMemoryLimit> property does not have any effect in modern .NET.

]]></format>
</remarks>
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/runtime/namedcaches-element-cache-settings">&lt;namedCaches&gt; Element (Cache Settings)</related>
</Docs>
</Member>
<Member MemberName="Contains">
Expand Down Expand Up @@ -541,11 +533,10 @@ You can specify the settings for the <xref:System.Runtime.Caching.MemoryCache.Ca
## Remarks
This property always returns a reference to the default cache instance. For typical application scenarios, only one instance of <xref:System.Runtime.Caching.MemoryCache> is required.

Because the default cache instance is not created by the constructor, you must use configuration to explicitly set the memory and polling values for the default cache instance. For more information, see [&lt;memoryCache&gt; Element (Cache Settings)](/dotnet/framework/configure-apps/file-schema/runtime/memorycache-element-cache-settings).
Because the default cache instance is not created by the constructor, you must use configuration to explicitly set the memory and polling values for the default cache instance.

]]></format>
</remarks>
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/runtime/memorycache-element-cache-settings">&lt;memoryCache&gt; Element (Cache Settings)</related>
</Docs>
</Member>
<Member MemberName="DefaultCacheCapabilities">
Expand Down Expand Up @@ -925,7 +916,6 @@ You can specify the settings for the <xref:System.Runtime.Caching.MemoryCache.Ca

]]></format>
</remarks>
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/runtime/namedcaches-element-cache-settings">&lt;namedCaches&gt; Element (Cache Settings)</related>
</Docs>
</Member>
<Member MemberName="PollingInterval">
Expand All @@ -951,11 +941,10 @@ You can specify the settings for the <xref:System.Runtime.Caching.MemoryCache.Ca
<format type="text/markdown"><![CDATA[

## Remarks
The settings for the <xref:System.Runtime.Caching.MemoryCache.PollingInterval> property can be specified in the application configuration file. Alternatively they can be passed when the <xref:System.Runtime.Caching.MemoryCache> class is initialized. For more information about how to configure this property, see [&lt;namedCaches&gt; Element (Cache Settings)](/dotnet/framework/configure-apps/file-schema/runtime/namedcaches-element-cache-settings). For more information about how to configure the property when the <xref:System.Runtime.Caching.MemoryCache> class is being initialized, see the <xref:System.Runtime.Caching.MemoryCache.%23ctor(System.String,System.Collections.Specialized.NameValueCollection)?displayProperty=nameWithType> method.
The settings for the <xref:System.Runtime.Caching.MemoryCache.PollingInterval> property can be specified when you call the <xref:System.Runtime.Caching.MemoryCache.%23ctor(System.String,System.Collections.Specialized.NameValueCollection)> constructor.

]]></format>
</remarks>
<related type="Article" href="/dotnet/framework/configure-apps/file-schema/runtime/namedcaches-element-cache-settings">&lt;namedCaches&gt; Element (Cache Settings)</related>
</Docs>
</Member>
<MemberGroup MemberName="Remove">
Expand Down
Loading
Loading