本文整理匯總了C#中ServiceStack.Redis.RedisClient.GetAllItemsFromSortedSetDesc方法的典型用法代碼示例。如果您正苦於以下問題:C# RedisClient.GetAllItemsFromSortedSetDesc方法的具體用法?C# RedisClient.GetAllItemsFromSortedSetDesc怎麽用?C# RedisClient.GetAllItemsFromSortedSetDesc使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ServiceStack.Redis.RedisClient
的用法示例。
在下文中一共展示了RedisClient.GetAllItemsFromSortedSetDesc方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: GetTrendingEvents
public List<string> GetTrendingEvents()
{
try
{
using (var redisClient = new RedisClient("ec2-50-17-76-244.compute-1.amazonaws.com"))
{
return redisClient.GetAllItemsFromSortedSetDesc("trending:events");
}
}
catch (Exception)
{
return new List<string>();
}
}
示例2: TestSortSet
private static void TestSortSet()
{
using (var client = new RedisClient("127.0.0.1", 6379))
{
#region "有序Set操作"
client.AddItemToSortedSet("HQF.Tutorial.Redis:SA", "B", 2);
client.AddItemToSortedSet("HQF.Tutorial.Redis:SA", "C", 1);
client.AddItemToSortedSet("HQF.Tutorial.Redis:SA", "D", 5);
client.AddItemToSortedSet("HQF.Tutorial.Redis:SA", "E", 3);
client.AddItemToSortedSet("HQF.Tutorial.Redis:SA", "F", 4);
//有序集合降序排列
Console.WriteLine("\n有序集合降序排列");
client.GetAllItemsFromSortedSetDesc("HQF.Tutorial.Redis:SA").ForEach(e => Console.Write(e + ","));
Console.WriteLine("\n有序集合升序序排列");
client.GetAllItemsFromSortedSet("HQF.Tutorial.Redis:SA").ForEach(e => Console.Write(e + ","));
client.AddItemToSortedSet("HQF.Tutorial.Redis:SB", "C", 2);
client.AddItemToSortedSet("HQF.Tutorial.Redis:SB", "F", 1);
client.AddItemToSortedSet("HQF.Tutorial.Redis:SB", "D", 3);
Console.WriteLine("\n獲得某個值在有序集合中的排名,按分數的升序排列");
Console.WriteLine(client.GetItemIndexInSortedSet("HQF.Tutorial.Redis:SB", "D"));
Console.WriteLine("\n獲得有序集合中某個值得分數");
Console.WriteLine(client.GetItemScoreInSortedSet("HQF.Tutorial.Redis:SB", "D"));
Console.WriteLine("\n獲得有序集合中,某個排名範圍的所有值");
client.GetRangeFromSortedSet("HQF.Tutorial.Redis:SA", 0, 3).ForEach(e => Console.Write(e + ","));
#endregion
}
}