static ChannelCacheSettings() { ChannelCacheSettings settings = new ChannelCacheSettings { MaxItemsInCache = 0 }; EmptyCacheSettings = settings; }
// use the default settings if null is specified for FactoryCacheSettings or ChannelCacheSettings public SendMessageChannelCache(ChannelCacheSettings factorySettings, ChannelCacheSettings channelSettings, bool allowUnsafeCaching) { this.allowUnsafeCaching = allowUnsafeCaching; this.FactorySettings = factorySettings; this.ChannelSettings = channelSettings; this.thisLock = new Object(); }
internal void InitializeChannelCacheEnabledSetting(SendMessageChannelCache channelCacheExtension) { Fx.Assert(channelCacheExtension != null, "channelCacheExtension cannot be null!"); ChannelCacheSettings factorySettings = channelCacheExtension.FactorySettings; Fx.Assert(factorySettings != null, "FactorySettings cannot be null!"); bool enabled; if (factorySettings.IdleTimeout == TimeSpan.Zero || factorySettings.LeaseTimeout == TimeSpan.Zero || factorySettings.MaxItemsInCache == 0) { enabled = false; } else { enabled = true; } if (!this.channelCacheEnabled.HasValue) { this.channelCacheEnabled = enabled; } else { Fx.Assert(this.channelCacheEnabled.Value == enabled, "Once ChannelCacheEnabled is set, it cannot be changed!"); } }
internal void InitializeChannelCacheEnabledSetting(SendMessageChannelCache channelCacheExtension) { bool flag; ChannelCacheSettings factorySettings = channelCacheExtension.FactorySettings; if (((factorySettings.IdleTimeout == TimeSpan.Zero) || (factorySettings.LeaseTimeout == TimeSpan.Zero)) || (factorySettings.MaxItemsInCache == 0)) { flag = false; } else { flag = true; } if (!this.channelCacheEnabled.HasValue) { this.channelCacheEnabled = new bool?(flag); } }
protected internal override object CreateBehavior() { SendMessageChannelCacheBehavior behavior = new SendMessageChannelCacheBehavior { AllowUnsafeCaching = this.AllowUnsafeCaching }; ChannelCacheSettings settings = new ChannelCacheSettings { IdleTimeout = this.FactorySettings.IdleTimeout, LeaseTimeout = this.FactorySettings.LeaseTimeout, MaxItemsInCache = this.FactorySettings.MaxItemsInCache }; behavior.FactorySettings = settings; ChannelCacheSettings settings2 = new ChannelCacheSettings { IdleTimeout = this.ChannelSettings.IdleTimeout, LeaseTimeout = this.ChannelSettings.LeaseTimeout, MaxItemsInCache = this.ChannelSettings.MaxItemsInCache }; behavior.ChannelSettings = settings2; return behavior; }
public SendMessageChannelCache(ChannelCacheSettings factorySettings, ChannelCacheSettings channelSettings) : this(factorySettings, channelSettings, ChannelCacheDefaults.DefaultAllowUnsafeSharing) { }
public SendMessageChannelCache(ChannelCacheSettings factorySettings, ChannelCacheSettings channelSettings) : this(factorySettings, channelSettings, false) { }