memcahe遷移到redis的示例:
主要實現代碼如下:
static void Main(string[] args)
{
MemCachedManager.CacheClient.Set("token","1111111");//測試數據
var redis = AppConfigurtaion.GetConfiguration().GetSection("AppSettings")["redis"];
//初始化redis連接
var csredis = new CSRedis.CSRedisClient(redis);
RedisHelper.Initialization(csredis);
//遷移mc數據到redis
IList
list = MemCachedManager.GetAllKeys();//mc已經在manager中初始化 foreach (string item in list)
{
var mcValue = MemCachedManager.CacheClient.Get(item);
CacheHelper.Set(item, mcValue, 86400 * 15, "redis");
}