keys
Version:
Unified api for node key/value stores
67 lines (66 loc) • 3.4 kB
JavaScript
/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['stores/redis.js']) {
_$jscoverage['stores/redis.js'] = [];
_$jscoverage['stores/redis.js'][12] = 0;
_$jscoverage['stores/redis.js'][15] = 0;
_$jscoverage['stores/redis.js'][16] = 0;
_$jscoverage['stores/redis.js'][17] = 0;
_$jscoverage['stores/redis.js'][20] = 0;
_$jscoverage['stores/redis.js'][21] = 0;
_$jscoverage['stores/redis.js'][24] = 0;
_$jscoverage['stores/redis.js'][25] = 0;
_$jscoverage['stores/redis.js'][28] = 0;
_$jscoverage['stores/redis.js'][29] = 0;
_$jscoverage['stores/redis.js'][32] = 0;
_$jscoverage['stores/redis.js'][33] = 0;
_$jscoverage['stores/redis.js'][34] = 0;
_$jscoverage['stores/redis.js'][38] = 0;
_$jscoverage['stores/redis.js'][39] = 0;
_$jscoverage['stores/redis.js'][42] = 0;
_$jscoverage['stores/redis.js'][43] = 0;
}
_$jscoverage['stores/redis.js'][12]++;
var redis = require("redis-client"), noop = (function () {
});
_$jscoverage['stores/redis.js'][15]++;
var Redis = module.exports = (function Redis(options) {
_$jscoverage['stores/redis.js'][16]++;
options = options || {};
_$jscoverage['stores/redis.js'][17]++;
this.client = new redis.createClient(options.port, options.host, options);
});
_$jscoverage['stores/redis.js'][20]++;
Redis.prototype.get = (function (key, fn) {
_$jscoverage['stores/redis.js'][21]++;
this.client.get(key, fn);
});
_$jscoverage['stores/redis.js'][24]++;
Redis.prototype.set = (function (key, val, fn) {
_$jscoverage['stores/redis.js'][25]++;
this.client.set(key, val, fn || noop);
});
_$jscoverage['stores/redis.js'][28]++;
Redis.prototype.remove = (function (key, fn) {
_$jscoverage['stores/redis.js'][29]++;
this.client.del(key, fn);
});
_$jscoverage['stores/redis.js'][32]++;
Redis.prototype.has = (function (key, fn) {
_$jscoverage['stores/redis.js'][33]++;
this.client.exists(key, (function (err, exists) {
_$jscoverage['stores/redis.js'][34]++;
fn(err, ! ! exists);
}));
});
_$jscoverage['stores/redis.js'][38]++;
Redis.prototype.length = (function (fn) {
_$jscoverage['stores/redis.js'][39]++;
this.client.dbsize(fn);
});
_$jscoverage['stores/redis.js'][42]++;
Redis.prototype.clear = (function (fn) {
_$jscoverage['stores/redis.js'][43]++;
this.client.flushdb(fn || noop);
});
_$jscoverage['stores/redis.js'].source = ["","/*!"," * Keys - Redis"," * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var redis = require('redis-client'),"," noop = function(){};","","var Redis = module.exports = function Redis(options) {"," options = options || {};"," this.client = new redis.createClient(options.port, options.host, options);","};","","Redis.prototype.get = function(key, fn){"," this.client.get(key, fn);","};","","Redis.prototype.set = function(key, val, fn){"," this.client.set(key, val, fn || noop);","};","","Redis.prototype.remove = function(key, fn){"," this.client.del(key, fn);","};","","Redis.prototype.has = function(key, fn){"," this.client.exists(key, function(err, exists){"," fn(err, !!exists);"," });","};","","Redis.prototype.length = function(fn){"," this.client.dbsize(fn);","};","","Redis.prototype.clear = function(fn){"," this.client.flushdb(fn || noop);","};"];