Skip to content

Commit

Permalink
Add clear command to base object, and simplify inspect
Browse files Browse the repository at this point in the history
  • Loading branch information
hfwang committed Jun 7, 2013
1 parent 2bf60d2 commit 02a3f5b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/BaseObject.js
Expand Up @@ -15,8 +15,12 @@ exports.prototype.redis = function() {
return this.myRedis || require('../index').connect();
};

exports.prototype.clear = function(callback) {
this.redis().del(this.key, callback);
};

exports.prototype.inspect = function() {
return '#<' + this.constructor.name + ' key: ' + this.key + ' opts: ' + JSON.stringify(this.options) + '>';
return '#<' + this.constructor.name + ' key: ' + this.key + '>';
};

require('./serialize').mixin(exports);

0 comments on commit 02a3f5b

Please sign in to comment.