基于.Net的Redis数据缓存,里面有很好的实例,一看就懂,最好搭配RedisDesktopManager一起使用
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace Weiz.Redis.RedisTest{ class Program { static void Main(string[] args) { Console.WriteLine("Redis写入缓存:zhong"); RedisCacheHelper.Add("zhong", "zhongzhongzhong", DateTime.Now.AddDays(1)); Console.WriteLine("Redis获取缓存:zhong"); string str3 = RedisCacheHelper.Get<string>("zhong"); Console.WriteLine(str3); Console.WriteLine("Redis获取缓存:nihao"); string str = RedisCacheHelper.Get<string>("nihao"); Console.WriteLine(str); Console.WriteLine("Redis获取缓存:wei"); string str1 = RedisCacheHelper.Get<string>("wei"); Console.WriteLine(str1); Console.ReadKey(); } }}
评论