本文整理匯總了C#中StackExchange.Redis.ConnectionMultiplexer.Dispose方法的典型用法代碼示例。如果您正苦於以下問題:C# ConnectionMultiplexer.Dispose方法的具體用法?C# ConnectionMultiplexer.Dispose怎麽用?C# ConnectionMultiplexer.Dispose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類StackExchange.Redis.ConnectionMultiplexer
的用法示例。
在下文中一共展示了ConnectionMultiplexer.Dispose方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MainForm
public MainForm()
{
InitializeComponent();
var options = new ConfigurationOptions
{
ConnectTimeout = 5000,
SyncTimeout = 2000,
KeepAlive = 60,
EndPoints =
{
{Settings.Default.RedisHost, Settings.Default.RedisPort}
}
};
_redis = ConnectionMultiplexer.Connect(options);
var retries = 0;
while (!_redis.IsConnected)
{
var config = _redis.Configuration;
_redis.Dispose();
if (retries > 10)
{
MessageBox.Show(string.Format("Could not connect to the Redis server with configuration: {0}",
config));
Application.Exit();
}
_redis = ConnectionMultiplexer.Connect(options, Console.Out);
retries++;
}
_red = new LightControlSet(button_RedOn, button_RedOff, button_RedFlash, textBox_RedOnDuty, textBox_RedOffDuty, textBox_RedOffset, textBox_RedPower, button_RedApply);
_green = new LightControlSet(button_GreenOn, button_GreenOff, button_GreenFlash, textBox_GreenOnDuty, textBox_GreenOffDuty, textBox_GreenOffset, textBox_GreenPower, button_GreenApply);
_blueYellow = new LightControlSet(button_BlueOn, button_BlueOff, button_BlueFlash, textBox_BlueOnDuty, textBox_BlueOffDuty, textBox_BlueOffset, textBox_BluePower, button_BlueApply);
}