Ask Learn
Preview
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value that indicates whether a cache of connections will be maintained by the application.
public:
static property bool EnableConnectionCache { bool get(); void set(bool value); };
[System.ComponentModel.Browsable(false)]
public static bool EnableConnectionCache { get; set; }
[<System.ComponentModel.Browsable(false)>]
static member EnableConnectionCache : bool with get, set
Public Shared Property EnableConnectionCache As Boolean
true
to create and use a connection cache; otherwise, false
.
The following code example gets and sets the value of a message queue's EnableConnectionCache property.
// Set the MessageQueue.EnableConnectionCache property value.
MessageQueue.EnableConnectionCache = false;
// Display the new value of the MessageQueue.EnableConnectionCache
// property.
Console.WriteLine("MessageQueue.EnableConnectionCache: {0}",
MessageQueue.EnableConnectionCache);
A connection cache is a list of references to structures that contain read or write handles to queues. When EnableConnectionCache is true
, the MessageQueue borrows handles from the cache each time you call Send(Object), Peek, or Receive, rather than open new handles. This can improve performance. Using a connection cache also insulates the MessageQueue from changes in the network topology.
If you create a new connection to a queue when the connection cache is full, the MessageQueue overwrites the least recently accessed structure with the new connection. You can clear the cache entirely by calling ClearConnectionCache, for example, if the format names of the queues you are working with have changed so that the previous read and write handles are no longer valid.
The following table shows whether this property is available in various Workgroup modes.
Workgroup mode | Available |
---|---|
Local computer | Yes |
Local computer and direct format name | Yes |
Remote computer | Yes |
Remote computer and direct format name | Yes |
Product | Versions |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Ask Learn is an AI assistant that can answer questions, clarify concepts, and define terms using trusted Microsoft documentation.
Please sign in to use Ask Learn.
Sign in