常用的Memcahed的基本用法
第一:安装Memcahed
第二:在服务里面启动Memcahed
public static class MemcahedHelper
{
private static MemcahedClient mc;
public MemcahedHelper()
{
string serverList={
"127.0.0.1:11211" //IP地址和端口号
};
SockIOPool pool=SockIOPool.GetInstance("text");
pool.SetServers(serverlist);
mc=new MemcahedClient();
mc.poolName="text";
mc.EnableCompression=false;
}
public static bool Set(string key,object value,DateTime expire)
{
mc.Set(key,value,expire);
}
public static object Get(string key)
{
return mc.Get(key)
}
}
}
原文:http://www.cnblogs.com/fanglovedbymiao/p/4892992.html