MessageQueue.EnableConnectionCache Property

Gets or sets a value that indicates whether a cache of connections will be maintained by the application.

Namespace: System.Messaging
Assembly: System.Messaging (in system.messaging.dll)

public static bool EnableConnectionCache { get; set; }
/** @property */
public static boolean get_EnableConnectionCache ()

/** @property */
public static void set_EnableConnectionCache (boolean value)

public static function get EnableConnectionCache () : boolean

public static function set EnableConnectionCache (value : boolean)

Property Value

true to create and use a connection cache; otherwise, false.

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

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);

// Set the MessageQueue.EnableConnectionCache property value.
MessageQueue.set_EnableConnectionCache(false);
// Display the new value of the MessageQueue.EnableConnectionCache
// property.
Console.WriteLine("MessageQueue.EnableConnectionCache: {0}", 
    System.Convert.ToString(MessageQueue.get_EnableConnectionCache()));

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0

Community Additions

ADD
Show: