upsert for redis
This commit is contained in:
parent
95c0e7d5d0
commit
29afdff4dc
|
@ -97,6 +97,11 @@ BridgeToRedis.prototype.create = function (model, data, callback) {
|
|||
}
|
||||
};
|
||||
|
||||
BridgeToRedis.prototype.updateOrCreate = function (model, data, callback) {
|
||||
if (!data.id) return this.create(model, data, callback);
|
||||
this.save(model, data, callback);
|
||||
};
|
||||
|
||||
BridgeToRedis.prototype.exists = function (model, id, callback) {
|
||||
var log = this.logger('EXISTS ' + model + ':' + id);
|
||||
this.client.exists(model + ':' + id, function (err, exists) {
|
||||
|
|
Loading…
Reference in New Issue