本文整理汇总了C#中ServiceStack.Redis.RedisClient.GetHashKeys方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.GetHashKeys方法的具体用法?C# RedisClient.GetHashKeys怎么用?C# RedisClient.GetHashKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ServiceStack.Redis.RedisClient
的用法示例。
在下文中一共展示了RedisClient.GetHashKeys方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IndexCrawlDate
private static void IndexCrawlDate(RedisClient Redis)
{
List<string> linkList = Redis.GetHashKeys("urn:link:data-last-date-crawl");
int i = 0;
Array.ForEach(linkList.ToArray(), link =>
{
i++;
Console.WriteLine(i + " of " + linkList.Count);
string dateValue = Redis.GetValueFromHash("urn:link:data-last-date-crawl", link);
string serializedLinks = Redis.GetValueFromHash("urn:link:date-last-crawl",
Convert.ToDateTime(dateValue).Date.ToString());
List<string> links;
if (string.IsNullOrEmpty(serializedLinks))
links = new List<string>();
else
links = serializedLinks.JsonDeserialize<List<string>>();
if (!links.Contains(link))
{
links.Add(link);
Redis.SetEntryInHash("urn:link:date-last-crawl",
Convert.ToDateTime(dateValue).Date.ToString(), links.JsonSerialize());
}
});
}
示例2: TestHash
private static void TestHash()
{
using (var client = new RedisClient("127.0.0.1", 6379))
{
client.SetEntryInHash("HQF.Tutorial.Redis:userInfoId", "name", "zhangsan");
client.SetEntryInHash("HQF.Tutorial.Redis:userInfoId", "name1", "zhangsan1");
client.SetEntryInHash("HQF.Tutorial.Redis:userInfoId", "name2", "zhangsan2");
client.SetEntryInHash("HQF.Tutorial.Redis:userInfoId", "name3", "zhangsan3");
client.GetHashKeys("HQF.Tutorial.Redis:userInfoId").ForEach(e => Console.WriteLine(e));
client.GetHashValues("HQF.Tutorial.Redis:userInfoId").ForEach(e => Console.WriteLine(e));
}
}