MailTransport.MaxTotalMessageCacheSize Property
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Gets or sets the maximum size of all messages that can be stored in the mail transport's cache.
Namespace: Microsoft.ServiceModel.Channels.Mail
Assembly: Microsoft.ServiceModel.Channels.Mail (in Microsoft.ServiceModel.Channels.Mail.dll)
Syntax
'Declaration
Public Property MaxTotalMessageCacheSize As Integer
Get
Set
'Usage
Dim instance As MailTransport
Dim value As Integer
value = instance.MaxTotalMessageCacheSize
instance.MaxTotalMessageCacheSize = value
public int MaxTotalMessageCacheSize { get; set; }
public:
property int MaxTotalMessageCacheSize {
int get ();
void set (int value);
}
member MaxTotalMessageCacheSize : int with get, set
Property Value
Type: System.Int32
The maximum combined size, in bytes, of all the messages that can be stored in the mail transport's cache. On the desktop, the default size is 50 MB. On a Windows Mobile device, the default size is 500 KB.
Exceptions
Exception | Condition |
---|---|
ArgumentOutOfRangeException | The MaxTotalMessageCacheSize is set to a value that is less than 0 (zero). |
Remarks
The in-memory cache, which is a separate cache from the e-mail store, helps improve performance by reducing the number of hits on the file system and on Web services. Messages that are received are stored in the cache until the application requests them. A performance issue may result if you set the cache size too small.
To get or set the maximum number of messages that can be stored in the cache, use the MaxTotalMessageCountInCache property.
Examples
The following example shows how to use the MaxTotalMessageCacheSize property.
' For a desktop application, use ExchangeWebServiceMailBinding.
binding = New WindowsMobileMailBinding()
binding.MinimumAttachmentSize = 1024
' Set lifetime to 1 day, 10 hours, 20 minutes, and 30 seconds.
binding.TimeToLive = New TimeSpan(1, 10, 20, 30)
binding.Transport.ReceiveRetryCount = 5
binding.Transport.MaxTotalMessageCacheSize = 1000
binding.Transport.MaxTotalMessageCountInCache = 128
// For a desktop application, use ExchangeWebServiceMailBinding.
binding = new WindowsMobileMailBinding();
binding.MinimumAttachmentSize = 1024;
// Set lifetime to 1 day, 10 hours, 20 minutes, and 30 seconds.
binding.TimeToLive = new TimeSpan(1, 10, 20, 30);
binding.Transport.ReceiveRetryCount = 5;
binding.Transport.MaxTotalMessageCacheSize = 1000;
binding.Transport.MaxTotalMessageCountInCache = 128;
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Platforms
Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Compact Framework
Supported in: 3.5