Default LRU cache size type is a unit

This commit is contained in:
Thaddee Tyl 2014-11-20 23:52:44 +01:00
parent ecaf11a50e
commit 70012f5574

View File

@ -8,6 +8,7 @@ var typeEnum = {
function Cache(size, type) {
if (!this instanceof Cache) { return new Cache(size, type); }
type = type || 'unit';
this.size = size;
this.type = typeEnum[type];
// `cache` contains {content, index}.
@ -68,7 +69,7 @@ Cache.prototype = {
return (this.order.length >> 1);
} else { return 0; }
} else {
console.error("Unknown heuristic for LRU cache.");
console.error("Unknown heuristic '" + this.type + "' for LRU cache.");
return 1;
}
},