Skip to content

Commit

Permalink
refactor: reuse implementation of _getId
Browse files Browse the repository at this point in the history
  • Loading branch information
cgc committed Sep 16, 2014
1 parent f753003 commit ebfb07f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internals.Policy.prototype.get = function (key, callback) { // key: string o

// Check if request is already pending

var id = (key && typeof key === 'object') ? key.id : key;
var id = this._getId(key);
if (this._pendings[id]) {
this._pendings[id].push(callback);
return;
Expand Down Expand Up @@ -194,7 +194,7 @@ internals.Policy.prototype.set = function (key, value, ttl, callback) {
}

ttl = ttl || internals.Policy.ttl(this.rule);
var id = (key && typeof key === 'object') ? key.id : key;
var id = this._getId(key);
this._cache.set({ segment: this._segment, id: id }, value, ttl, callback);
};

Expand Down

0 comments on commit ebfb07f

Please sign in to comment.