本文整理匯總了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();
}