zoukankan      html  css  js  c++  java
  • C#操作Redis Hash数据表

     /// <summary>
            /// Redis Hash
            /// </summary>
            public static void Redis_Hash()
            {
                RedisClient client = new RedisClient("127.0.0.1", 6379);
                //清空数据库缓存,慎用
                client.FlushAll();
                #region Hash
                client.SetEntryInHash("Hash", "Name", "lily");
                client.SetEntryInHash("Hash", "Age", "18");
                client.SetEntryInHash("Hash", "Sex", "");
                client.SetEntryInHash("Hash", "Address", "初中高中英语课本");
    
                //获取指定hash表中key的集合
                List<string> HaskKey = client.GetHashKeys("Hash");
                //然后便利当前key
                foreach (string key in HaskKey)
                {
                    Console.WriteLine("Hash--Key:{0}", key);
                }
                //获取指定hash表中value的集合
                List<string> HaskValue = client.GetHashValues("Hash");
                //便利当前value
                foreach (string value in HaskValue)
                {
                    Console.WriteLine("Hash--Value:{0}", value);
                }
    
                //获取所有的key。
                List<string> AllKey = client.GetAllKeys(); //获取所有的key。
                foreach (string Key in AllKey)
                {
                    Console.WriteLine("AllKey--Key:{0}", Key);
                }
                #endregion
            }
  • 相关阅读:
    python中的unlink
    if
    python中if __name__ == '__main__'
    rename函数
    win2003的密钥
    url
    python中的os.stat
    python中的mysql
    防火墙
    网址
  • 原文地址:https://www.cnblogs.com/happygx/p/8416620.html
Copyright © 2011-2022 走看看