【发布时间】:2017-05-19 01:30:00
【问题描述】:
我正在尝试使用 Nodejs 在我的应用程序中设置 AWS elasticache (memcache)。
我想将 json 对象存储到缓存中并做到了
elastic.connect().then(function(instance){
var profile = {
'name':'Rohit kumar',
'location':'Delhi',
'emailid':'iamrohitx@gmail.com'
}
instance.set('profile', profile, false, 10000);
instance.get('profile').then(function(cacheData){
console.log(cacheData);
});
});
cacheData 在“get”之后返回 [object object] 作为字符串。
由于某种原因,如果值是字符串而不是对象,我能够设置和获取
instance.set('profile', 'profile 1 string', false, 10000);
instance.get('profile').then(function(cacheData){
console.log(cacheData); // get 'profile 1 string'
});
elasticache 可以处理 json 吗?我认为如果它不能,它会很弱。
感谢您的帮助!
【问题讨论】:
-
我能问一下为什么要投反对票吗?
标签: javascript node.js amazon-web-services amazon-elasticache