Exemplo n.º 1
0
        private static void TestString()
        {
            using (var client = new RedisClient("127.0.0.1", 6379))
            {
                #region "字符串类型"
                client.Set<string>("HQF.Tutorial.Redis:name", "Reis");
                string userName = client.Get<string>("HQF.Tutorial.Redis:name");
                Console.WriteLine(userName);

                //访问次数
                client.Set<int>("HQF.Tutorial.Redis:IpAccessCount", 0);
                //次数递增
                client.Incr("HQF.Tutorial.Redis:IpAccessCount");
                Console.WriteLine(client.Get<int>("HQF.Tutorial.Redis:IpAccessCount"));
                #endregion
            }

        }