本文整理汇总了C#中ServiceStack.Redis.RedisClient.SetConfig方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.SetConfig方法的具体用法?C# RedisClient.SetConfig怎么用?C# RedisClient.SetConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceStack.Redis.RedisClient
的用法示例。
在下文中一共展示了RedisClient.SetConfig方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Can_recover_from_server_terminated_client_connection
public void Can_recover_from_server_terminated_client_connection()
{
const int SleepHoldingClientMs = 5;
const int SleepAfterReleasingClientMs = 0;
const int loop = 1000;
var admin = new RedisClient("localhost");
admin.SetConfig("timeout", "0");
var timeout = admin.GetConfig("timeout");
timeout.Print("timeout: {0}");
int remaining = loop;
var stopwatch = Stopwatch.StartNew();
var clientManager = new PooledRedisClientManager(new[] { "localhost" })
{
};
loop.Times(i =>
{
ThreadPool.QueueUserWorkItem(x =>
{
try
{
using (var client = (RedisClient)clientManager.GetClient())
{
client.IncrementValue("key");
var val = client.Get<long>("key");
"#{0}, isConnected: {1}".Print(val, true); //client.IsSocketConnected()
Thread.Sleep(SleepHoldingClientMs);
}
Thread.Sleep(SleepAfterReleasingClientMs);
}
catch (Exception ex)
{
ex.Message.Print();
}
finally
{
remaining--;
}
});
});
while (remaining > 0)
{
Thread.Sleep(10);
}
"Elapsed time: {0}ms".Print(stopwatch.ElapsedMilliseconds);
var managerStats = clientManager.GetStats();
managerStats.PrintDump();
}