SendMessageChannelCache 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
表示一个扩展,它允许自定义缓存共享级别、通道工厂缓存的设置,以及用于使用 Send 消息传送活动将消息发送到服务终结点的工作流的通道缓存的设置。
public ref class SendMessageChannelCache sealed : IDisposable
public sealed class SendMessageChannelCache : IDisposable
type SendMessageChannelCache = class
interface IDisposable
Public NotInheritable Class SendMessageChannelCache
Implements IDisposable
- 继承
-
SendMessageChannelCache
- 实现
示例
以下示例演示如何使用 SendMessageChannelCache 类在单个应用域中的两个工作流应用程序之间共享通道缓存。
//sharing a channel cache between two workflow applications in a single app-domain.
sharedChannelCache = new SendMessageChannelCache(new ChannelCacheSettings { MaxItemsInCache = 5 }, new ChannelCacheSettings { MaxItemsInCache = 5 });
WorkflowApplication workflowApp1 = new WorkflowApplication(workflow);
workflowApp1.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp1.Extensions.Add(sharedChannelCache);
WorkflowApplication workflowApp2 = new WorkflowApplication(workflow);
workflowApp2.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp2.Extensions.Add(sharedChannelCache);
//disabling the channel cache so that channels are closed after being used.
SendMessageChannelCache disabledChannelCache = new SendMessageChannelCache(new ChannelCacheSettings { MaxItemsInCache = 0 }, new ChannelCacheSettings { MaxItemsInCache = 0 });
WorkflowApplication workflowApp3 = new WorkflowApplication(workflow);
workflowApp3.Completed = new Action<WorkflowApplicationCompletedEventArgs>(OnCompleted);
workflowApp3.Extensions.Add(disabledChannelCache);
注解
此类适用于将消息发送到服务终结点的工作流。 这些工作流通常是客户端工作流,但也可以是托管在一个 WorkflowServiceHost工作流中的工作流服务。
默认情况下,在由 a WorkflowServiceHost托管的工作流中,消息传递活动使用的 Send 缓存在(主机级缓存)中的所有工作流实例之间 WorkflowServiceHost 共享。 对于不是由 a WorkflowServiceHost托管的客户端工作流,缓存仅适用于工作流实例(实例级缓存)。 默认情况下,对于工作流中具有配置中定义的终结点的任何发送活动,将禁用缓存。
有关如何更改通道工厂和通道缓存的默认缓存共享级别和缓存设置的详细信息,请参阅 更改发送活动的缓存共享级别。
构造函数
| 名称 | 说明 |
|---|---|
| SendMessageChannelCache() |
使用默认工厂缓存和通道缓存设置初始化类的新实例 SendMessageChannelCache 。 |
| SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings, Boolean) |
使用自定义工厂缓存设置、自定义通道缓存设置以及指示是否打开缓存的值初始化类的新实例 SendMessageChannelCache 。 |
| SendMessageChannelCache(ChannelCacheSettings, ChannelCacheSettings) |
使用自定义工厂缓存和通道缓存设置初始化类的新实例 SendMessageChannelCache 。 |
属性
| 名称 | 说明 |
|---|---|
| AllowUnsafeCaching |
获取或设置一个值,该值指示是否打开缓存。 |
| ChannelSettings |
获取或设置通道缓存的设置。 |
| FactorySettings |
获取或设置通道工厂缓存的设置。 |
方法
| 名称 | 说明 |
|---|---|
| Dispose() |
释放类的 SendMessageChannelCache 当前实例使用的所有资源。 |
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |