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");
}