本文整理汇总了C#中ServiceStack.Redis.RedisClient.RPush方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.RPush方法的具体用法?C# RedisClient.RPush怎么用?C# RedisClient.RPush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceStack.Redis.RedisClient
的用法示例。
在下文中一共展示了RedisClient.RPush方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Generate
public static void Generate(RedisTestParameters parms)
{
var hostName = System.Environment.MachineName + "." +
Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
"SYSTEM\\CurrentControlSet\\services\\Tcpip\\Parameters").GetValue("Domain", "").ToString();
var rc = new RedisClient(parms.Host, parms.Port);
for (int i = 0; i < parms.NumMessages; i++)
{
JObject o = new JObject
{
{"Application", "redis-generator"},
{"Host", hostName},
{"UtcTimestamp", DateTime.UtcNow.ToString("o")},
{"Type", "redis"},
{"Message", "redis message " + DateTime.UtcNow.ToString("o")},
{"Index", "logstash"}
};
byte[] bytes = System.Text.Encoding.UTF8.GetBytes(o.ToString());
var restult = rc.RPush("logstash", bytes);
}
}
示例2: ProcessUserInput
private static string ProcessUserInput(RedisClient redisClient, string username, string otherUsername)
{
string input = Console.ReadLine();
if (otherUsername == null)
{
if (redisClient.SIsMember("usernames", input.ToAsciiCharArray()) != 0)
{
otherUsername = input;
return otherUsername;
}
else
{
Console.WriteLine("Wrong username, try again!");
return null;
}
}
else
{
if (input.ToLower() != "/exit")
{
string chatName = username.CompareTo(otherUsername) < 0 ? username + "-" + otherUsername : otherUsername + "-" + username;
redisClient.RPush("chat:" + chatName, (username + ": " + input).ToAsciiCharArray());
}
else
{
otherUsername = null;
}
return otherUsername;
}
}