Redis

Redis data types

The supported data types are:

  • Strings
  • Lists
  • Sets
  • Sorted Sets
  • Hashes

multi command to execute multiple operations : just like innodb transactions

for storing multi level hashes in redis , we convert the multilevel hashes in the string , and save it as string , and eval them while retrieving. sadd command add a memeber to the set

clientredis.sadd('buffers.'+user.username, JSON.stringify(event));

and for retrieving the string saved we use smember to retrieve all element of a set .we will parse the json from the string.

 

 clientredis.smembers("buffers."+request.username , function(err, buffer) {
      for (var i=0; i<buffer.length; i++){
        JSON.parse(buffer[i]);
      }
    });

 

Ref :

http://blog.mjrusso.com/2010/10/17/redis-from-the-ground-up.html

Advertisements

About rahul23134654

Hi, I am Rahul Meha , B.E. in (I.T.)
This entry was posted in Node.js. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s