title: how to get all keys and values in redis in javascript?
body: <p>I am creating a node API using javascript. I have used redis as my key value store.
  I created a redis-client in my app and am able to get values for perticular key.</p>
  
  <p>I want to retrieve all keys along with their values.
  So Far I have done this :</p>
  
  <pre><code>app.get('/jobs', function (req, res) {
      var jobs = [];
      client.keys('*', function (err, keys) {
          if (err) return console.log(err);
          if(keys){
              for(var i=0;i&lt;keys.length;i++){
                  client.get(keys[i], function (error, value) {
                      if (err) return console.log(err);
                      var job = {};
                      job['jobId']=keys[i];
                      job['data']=value;
                      jobs.push(job);
                  });  
              }
              console.log(jobs);
              res.json({data:jobs});
          }
      });
  });
  </code></pre>
  
  <p>but I always get blank array in response.</p>
  
  <p>is there any way to do this in javascript?</p>
  
  <p>Thanks</p>