当前位置: 首页>>代码示例>>C#>>正文


C# RedisClient.HSet方法代码示例

本文整理汇总了C#中ServiceStack.Redis.RedisClient.HSet方法的典型用法代码示例。如果您正苦于以下问题:C# RedisClient.HSet方法的具体用法?C# RedisClient.HSet怎么用?C# RedisClient.HSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServiceStack.Redis.RedisClient的用法示例。


在下文中一共展示了RedisClient.HSet方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChangeTranslation

 private static void ChangeTranslation(RedisClient client)
 {
     Console.WriteLine("Enter word.");
     string word = Console.ReadLine();
     byte[] wordInBytes = Extensions.ToAsciiCharArray(word);
     Console.WriteLine("Enter translation.");
     string translation = Console.ReadLine();
     byte[] translationInBytes = Extensions.ToAsciiCharArray(translation);
     if (!string.IsNullOrWhiteSpace(word) && !string.IsNullOrWhiteSpace(translation))
     {
         if (client.HExists(dictionary, wordInBytes) == 1)
         {
             client.HSet(dictionary, wordInBytes, translationInBytes);
             Console.WriteLine("Translation of the word {0} is changed.", word);
         }
         else
         {
             Console.WriteLine("There is no word {0}.", word);
         }
     }
     else
     {
         Console.WriteLine("You enter null or empty string for word or translation. Please try again.");
     }
 }
开发者ID:vasilkrvasilev,项目名称:Databases,代码行数:25,代码来源:RedisDictionary.cs

示例2: EditWord

 public static void EditWord(RedisClient words)
 {
     Console.Write("Enter word for edit: ");
     string editWord = Console.ReadLine().ToLower();
     Console.Write("Enter new translation: ");
     string translation = Console.ReadLine().ToLower();
     long countWords = words.HExists("words", Extensions.ToAsciiCharArray(editWord));
     if (countWords>0)
     {
         words.HSet("words", Extensions.ToAsciiCharArray(editWord), Extensions.ToAsciiCharArray(translation));
     }
     else
     {
         Console.WriteLine("This word is not exist");
     }
 }
开发者ID:Gerya,项目名称:TelerikAcademy,代码行数:16,代码来源:Utilities.cs

示例3: DoUpdateChangeKey

        private void DoUpdateChangeKey(RedisClient client, string setId, object keyByte, byte[] values, bool isHash, byte[] buffer)
        {
            string key = isHash
                ? Encoding.UTF8.GetString((byte[])keyByte)
                : keyByte.ToString();
            dynamic entity = null;
            try
            {
                entity = CovertEntityObject(key, values);
                CacheType cacheType = CacheType.None;
                if (entity != null)
                {
                    SchemaTable schema;
                    Type entityType = entity.GetType();
                    if (!EntitySchemaSet.TryGet(entityType, out schema))
                    {
                        EntitySchemaSet.InitSchema(entityType);
                    }
                    if (schema != null || EntitySchemaSet.TryGet(entityType, out schema))
                    {
                        cacheType = schema.CacheType;
                    }
                    if (cacheType != CacheType.None)
                    {
                        string redisKey = cacheType == CacheType.Dictionary
                            ? key.Split('|')[0]
                            : key.Split('_')[0];

                        using (IDataSender sender = DataSyncManager.GetRedisSender(schema, redisKey))
                        {
                            sender.Send(entity);

                        }
                    }

                }
            }
            catch (Exception ex)
            {
                TraceLog.WriteError("ChangeKey:{0} error:{1}", key, ex);
            }
            if (isHash)
            {
                client.HDel(setId, (byte[])keyByte);
            }
            else
            {
                client.ZRem(setId, buffer);
            }
            if (entity != null)
            {
                Type type = entity.GetType();
                string entityKey = string.Format("{0},{1}", key, type.Assembly.GetName().Name);
                client.HSet("__GLOBAL_SQL_CHANGE_KEYS_NEW", Encoding.UTF8.GetBytes(entityKey), new byte[] { 1 });
            }

        }
开发者ID:LeeWangyeol,项目名称:Scut,代码行数:57,代码来源:CacheUpdateQueueForm.cs

示例4: AddEntry

 public static void AddEntry(RedisClient redisIO, Entry entry)
 {
     redisIO.HSet("Dictonary", entry.Name.ToAsciiCharArray(), entry.Translation.ToAsciiCharArray());
 }
开发者ID:HansS,项目名称:TelerikAcademy-homework,代码行数:4,代码来源:Program.cs

示例5: AddNewEntry

 static void AddNewEntry(RedisClient redisClient, string word, string translation)
 {
     redisClient.HSet(
         DictionaryStructure,
         Extensions.ToAsciiCharArray(word),
         Extensions.ToAsciiCharArray(translation));
 }
开发者ID:vladislav-karamfilov,项目名称:TelerikAcademy,代码行数:7,代码来源:DictionaryRedisUI.cs


注:本文中的ServiceStack.Redis.RedisClient.HSet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。