// 获取阿里云SDK实例 |
var ALY = require(‘aliyun-sdk‘); |
// 创建 OCS 的 memcached 实例 |
// 其中,host 为实例的 ip 地址 |
var memcached = ALY.MEMCACHED.createClient(11211, host, { |
username: ocsKey, |
password: ocsSecret |
}); |
// 向 OCS 中写入数据 |
memcached.add(‘1257893‘, function(err, data) { |
// 如果写入数据错误 |
if(err) { |
console.log(‘add error:’, err); |
return; |
} |
// 写入数据成功,打印返回值 |
console.log(‘add success:’, data); |
}); |