Skip to content

Commit

Permalink
Fixed fetch throwing error if never set with ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
mallocator committed Mar 21, 2017
1 parent 8f345fe commit a389449
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Cache {
fetch(type, id, cb) {
type = typeof type === 'string' ? type : String(type);
id = typeof id === 'string' ? id : String(id);
if (this._ttl) {
if (this._ttl && this._timeouts[type]) {
this._timeouts[type][id] && clearTimeout(this._timeouts[type][id]);
this._timeouts[type][id] = setTimeout(this.remove.bind(this, type, id), this._ttl);
}
Expand Down

0 comments on commit a389449

Please sign in to comment.