本文整理汇总了C#中ServiceStack.Redis.RedisClient.AddRangeToList方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.AddRangeToList方法的具体用法?C# RedisClient.AddRangeToList怎么用?C# RedisClient.AddRangeToList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceStack.Redis.RedisClient
的用法示例。
在下文中一共展示了RedisClient.AddRangeToList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: simpleRedisGetSet
static void simpleRedisGetSet()
{
string host = "localhost";
string elementKey = "testKeyRedis";
RedisClient redisclient = new RedisClient(host);
redisclient.Remove(elementKey);
var storeMembers = new List<string> { "asd","dsd","bb"};
// storeMembers.ForEach(x=>redisclient.AddItemToList(elementKey,x));
redisclient.AddRangeToList(elementKey,storeMembers);
var members = redisclient.GetAllItemsFromList(elementKey);
var list = redisclient.Lists[elementKey];
list.Clear();
var ser = new ObjectSerializer();
bool result = redisclient.Set<byte[]>(elementKey, ser.Serialize(storeMembers));
if (result)
{
var resultlist = ser.Deserialize(redisclient.Get<byte[]>(elementKey));
}
members.ForEach(s=>Console.WriteLine("list:"+s));
// Console.WriteLine("index2:"+redisclient.GetItemFromList(elementKey,1));
//if (redisclient.Get<string>(elementKey) == null)
//{
// redisclient.Set(elementKey, "defaultValue");
//}
//else {
// redisclient.Set(elementKey, "new default value");
//}
//Console.WriteLine("redise:value:"+redisclient.Get<string>(elementKey));
Console.WriteLine(redisclient.Info);
}