本文整理汇总了C#中ServiceStack.Redis.RedisClient.GetAllItemsFromList方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.GetAllItemsFromList方法的具体用法?C# RedisClient.GetAllItemsFromList怎么用?C# RedisClient.GetAllItemsFromList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceStack.Redis.RedisClient
的用法示例。
在下文中一共展示了RedisClient.GetAllItemsFromList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestList
private static void TestList()
{
using (var client = new RedisClient("127.0.0.1", 6379))
{
#region "List类型"
client.AddItemToList("HQF.Tutorial.Redis:userInfoId1", "123");
client.AddItemToList("HQF.Tutorial.Redis:userInfoId1", "1234");
Console.WriteLine("List数据项条数:" + client.GetListCount("HQF.Tutorial.Redis:userInfoId1"));
Console.WriteLine("List数据项第一条数据:" + client.GetItemFromList("HQF.Tutorial.Redis:userInfoId1", 0));
Console.WriteLine("List所有数据");
client.GetAllItemsFromList("HQF.Tutorial.Redis:userInfoId1").ForEach(e => Console.WriteLine(e));
#endregion
#region "List类型做为队列和栈使用"
Console.WriteLine(client.GetListCount("HQF.Tutorial.Redis:userInfoId1"));
//队列先进先出
//Console.WriteLine(client.DequeueItemFromList("userInfoId1"));
//Console.WriteLine(client.DequeueItemFromList("userInfoId1"));
//栈后进先出
Console.WriteLine("出栈" + client.PopItemFromList("HQF.Tutorial.Redis:userInfoId1"));
Console.WriteLine("出栈" + client.PopItemFromList("HQF.Tutorial.Redis:userInfoId1"));
#endregion
}
}
示例2: IndexDomainOrSubdomain
private static void IndexDomainOrSubdomain(RedisClient Redis)
{
List<string> keys = Redis.SearchKeys("urn:link:domain-or-subdomain:*");
for (int i = 0; i < keys.Count; i++)
{
List<string> links = Redis.GetAllItemsFromList(keys[i]);
string domainOrSubdomain = keys[0].Substring(29);
Console.WriteLine(i + ": " + domainOrSubdomain);
Redis.SetEntryInHash("urn:link:domain-or-subdomain",
domainOrSubdomain, links.JsonSerialize());
}
}
示例3: 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);
}