I am trying to setup AWS elasticache (memcache) in my app with Nodejs.
I wanted to store json object to the cache and did
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);
});
});
The cacheData
return [object object]
as a string after ‘get
’.
For some reason, I was able to set and get if the value is string but not an object
instance.set('profile', 'profile 1 string', false, 10000);
instance.get('profile').then(function(cacheData){
console.log(cacheData); // get 'profile 1 string'
});
Can elasticache
handle json? I thought it would be weak if it can’t.
Thanks for the help!
via Jwqq
No comments:
Post a Comment