cd C:\Program Files\MemCacheD
memcached.exe -d install
memcached.exe -d start
using System;
System.Collections.Generic;
System.Linq;
System.Web;
System.Web.UI;
System.Web.UI.WebControls;
Memcached.ClientLibrary; //--------------引用
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender,EventArgs e)
{
if (!IsPostBack)
{
//参数设置
string SockIOPoolName = "demo";
string[] MemcacheServiceList = { 127.0.0.1:11216 };
设置连接池
SockIOPool SPool = SockIOPool.GetInstance(SockIOPoolName);
SPool.SetServers(MemcacheServiceList);
SPool.Initialize();
实例化Client
MemcachedClient MClient = new MemcachedClient();
MClient.PoolName = SockIOPoolName;
MClient.Add(",Hello World);
Response.Write(缓存的值:" + MClient.Get(Key1001));
}
}
}
router.get('/',function (req,res,next) {
var Memcached = require('cacher-memcached');
var cacher = new Memcached("192.168.20.135:11216",{});
cacher.set("key01","testValue1",10);
cacher.get('key01',1)">(err,val) {
console.log("MemCache取值为:" + val);
});
res.render('index',{title: "cacher-memcahced测试~"});
});