-1

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
Jwqq
  • 997
  • 4
  • 14
  • 22

1 Answers1

0

We can store the Serializable Object only in Memcached.