當前位置: 首頁>>代碼示例>>C#>>正文


C# RedisClient.HGetAll方法代碼示例

本文整理匯總了C#中ServiceStack.Redis.RedisClient.HGetAll方法的典型用法代碼示例。如果您正苦於以下問題:C# RedisClient.HGetAll方法的具體用法?C# RedisClient.HGetAll怎麽用?C# RedisClient.HGetAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ServiceStack.Redis.RedisClient的用法示例。


在下文中一共展示了RedisClient.HGetAll方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PrintAllWords

        private static void PrintAllWords(RedisClient client)
        {
            var words = client.HGetAll("dictionary"); // returns byte[][], where first dimension is [key],[value],..,[key],[value]

            Console.WriteLine("All words in dictionary:");
            for (int i = 0; i < words.GetLength(0); i+=2)
            {
                Console.WriteLine("{0} -> {1}",
                    IntoString(words[i]), IntoString(words[i+1]));
            }
        }
開發者ID:psotirov,項目名稱:TelerikAcademyProjects,代碼行數:11,代碼來源:RedisDictionary.cs

示例2: ListAllEntries

        public static void ListAllEntries(RedisClient redisIO)
        {
            Console.WriteLine("List");

            Console.WriteLine(new string('-', Console.WindowWidth - 5));

            foreach (var item in redisIO.HGetAll("Dictonary"))
            {
                Console.WriteLine(StringExtensions.StringFromByteArray(item));
                Console.WriteLine(new string('-', Console.WindowWidth - 5));
            }
        }
開發者ID:HansS,項目名稱:TelerikAcademy-homework,代碼行數:12,代碼來源:Program.cs

示例3: findlen

        static void findlen()
        {
            using (var redisClient = new RedisClient(redisHost, Convert.ToInt16(redisPort)))
            {
                double totalsize = 0;
                var keys = redisClient.GetAllKeys();
                foreach (string key in keys)
                {
                    try
                    {
                        byte[] bytarr = redisClient.Get(key);
                        double kblen = ConvertBytesToKilobytes(bytarr.Length);
                        double mblen = ConvertBytesToMegabytes(bytarr.Length);
                        totalsize = totalsize + mblen;
                        Console.WriteLine("Key Name : " + key + " Key length in MB : " + mblen + " Key Length in Kb : " + kblen);
                        using (System.IO.StreamWriter file = new System.IO.StreamWriter(@FilePathToStoreResult, true))
                        {
                            file.WriteLine("Key Name : " + key + " Key length in MB : " + mblen + " Key Length in Kb : " + kblen);
                        }

                    }
                    catch (Exception ex)
                    {
                        try
                        {
                            byte[][] bythsharr = redisClient.HGetAll(key);
                            double kblen = ConvertBytesToKilobytes(bythsharr.Length);
                            double mblen = ConvertBytesToMegabytes(bythsharr.Length);
                            Console.WriteLine("Hash Key Name : " + key + " Key length in MB : " + mblen + " Key Length in Kb : " + kblen);
                            using (System.IO.StreamWriter file =new System.IO.StreamWriter(@FilePathToStoreResult, true))
                            {
                                file.WriteLine("Hash Key Name : " + key + " Key length in MB : " + mblen + " Key Length in Kb : " + kblen);
                            }
                            totalsize = totalsize + mblen;
                        }
                        catch (Exception ex1)
                        {

                        }
                    }
                }
            }
        }
開發者ID:abhiyx,項目名稱:RedisSizeCalculator,代碼行數:43,代碼來源:Program.cs

示例4: ListItems

        public static void ListItems(RedisClient redisDictionaryClient)
        {
            var allItems = redisDictionaryClient.HGetAll(ColectionKey);

            for (int i = 0; i < allItems.Length; i = i + 2)
            {
                Console.WriteLine("Word: {0} - Translation: {1}",
                    Extensions.StringFromByteArray(allItems[i]), Extensions.StringFromByteArray(allItems[i + 1]));
            }

            Console.WriteLine();
        }
開發者ID:quela,項目名稱:myprojects,代碼行數:12,代碼來源:RedisDBDictionaryClient.cs

示例5: PrintAllEntries

 static void PrintAllEntries(RedisClient redisClient)
 {
     var entries = redisClient.HGetAll(DictionaryStructure);
     for (int i = 0; i < entries.Length; i += 2)
     {
         Console.WriteLine(
             "{0} -> {1}",
             Extensions.StringFromByteArray(entries[i]),
             Extensions.StringFromByteArray(entries[i + 1]));
     }
 }
開發者ID:vladislav-karamfilov,項目名稱:TelerikAcademy,代碼行數:11,代碼來源:DictionaryRedisUI.cs


注:本文中的ServiceStack.Redis.RedisClient.HGetAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。