<commit_before>var Q = require('q');

module.exports = Qedis;

function Qedis(redisClient) {
  this.redisClient = redisClient;
}

Qedis.prototype.exists = function(cacheKey) {
  return Q.ninvoke(this.redisClient, 'exists', cacheKey)
  .fail(failureHandler)
};

Qedis.prototype.fetch = function(cacheKey) {
  var self = this;
  return Q.ninvoke(this.redisClient, 'keys', cacheKey)
  .then(function(keys) {
    return Q.all(
      keys.map(function(key) {
        return self.get(key);
      })
    );
  })
  .fail(failureHandler)
};

Qedis.prototype.get = function(cacheKey) {
  return Q.ninvoke(this.redisClient, 'get', cacheKey)
  .then(JSON.parse.bind(JSON))
  .fail(failureHandler)
};

Qedis.prototype.set = function(cacheKey, value) {
  return Q.ninvoke(this.redisClient, 'set', cacheKey, JSON.stringify(value))
  .fail(failureHandler)
};

Qedis.prototype.blpop = function() {
  return Q.ninvoke.apply(Q, [this.redisClient, 'blpop'].concat([].slice.call(arguments)))
  .then(JSON.parse.bind(JSON))
  .fail(failureHandler)
};

Qedis.prototype.lrange = function(start, end) {
  return Q.ninvoke(this.redisClient, 'lrange', start, end)
  .then(JSON.parse.bind(JSON))
  .fail(failureHandler)
};

Qedis.prototype.lpop = function(list) {
  return Q.ninvoke(this.redisClient, 'lpop', list)
  .then(JSON.parse.bind(JSON))
  .fail(failureHandler)
};

Qedis.prototype.lpush = function(list, obj) {
  return Q.ninvoke(this.redisClient, 'lpush', list, JSON.stringify(obj))
  .fail(failureHandler)
};

Qedis.prototype.rpush = function(list, obj) {
  return Q.ninvoke(this.redisClient, 'rpush', list, JSON.stringify(obj))
  .fail(failureHandler)
};

function failureHandler(err) {
  console.log(err.stack);
  throw err;
}
<commit_msg>add method sendCommand<commit_after>var Q = require('q');

module.exports = Qedis;

function Qedis(redisClient) {
  this.redisClient = redisClient;
}

Qedis.prototype.exists = function(cacheKey) {
  return Q.ninvoke(this.redisClient, 'exists', cacheKey)
  .fail(failureHandler)
};

Qedis.prototype.fetch = function(cacheKey) {
  var self = this;
  return Q.ninvoke(this.redisClient, 'keys', cacheKey)
  .then(function(keys) {
    return Q.all(
      keys.map(function(key) {
        return self.get(key);
      })
    );
  })
  .fail(failureHandler)
};

Qedis.prototype.get = function(cacheKey) {
  return Q.ninvoke(this.redisClient, 'get', cacheKey)
  .then(JSON.parse.bind(JSON))
  .fail(failureHandler)
};

Qedis.prototype.set = function(cacheKey, value) {
  return Q.ninvoke(this.redisClient, 'set', cacheKey, JSON.stringify(value))
  .fail(failureHandler)
};

Qedis.prototype.blpop = function() {
  return Q.ninvoke.apply(Q, [this.redisClient, 'blpop'].concat([].slice.call(arguments)))
  .then(JSON.parse.bind(JSON))
  .fail(failureHandler)
};

Qedis.prototype.lrange = function(start, end) {
  return Q.ninvoke(this.redisClient, 'lrange', start, end)
  .then(JSON.parse.bind(JSON))
  .fail(failureHandler)
};

Qedis.prototype.lpop = function(list) {
  return Q.ninvoke(this.redisClient, 'lpop', list)
  .then(JSON.parse.bind(JSON))
  .fail(failureHandler)
};

Qedis.prototype.lpush = function(list, obj) {
  return Q.ninvoke(this.redisClient, 'lpush', list, JSON.stringify(obj))
  .fail(failureHandler)
};

Qedis.prototype.rpush = function(list, obj) {
  return Q.ninvoke(this.redisClient, 'rpush', list, JSON.stringify(obj))
  .fail(failureHandler)
};

Qedis.prototype.sendCommand = function(command, args) {
  return Q.ninvoke(this.redisClient, 'send_command', command, args)
  .fail(failureHandler);
};

function failureHandler(err) {
  console.log(err.stack);
  throw err;
}

{'fraction_non_alphanumeric': 0.16177285318559556, 'fraction_numerical': 0.0, 'mean_word_length': 4.668759811616955, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '150660', 'n_tokens_mistral': 1325, 'n_tokens_neox': 1324, 'n_words': 207}