export class CacheTable{ constructor(threshold){ this.entries = {}; this.count = 0; this.threshold = threshold || 1024; } set(key, val){ if(this.entries[key] === undefined){ if(this.count < this.threshold){ this.count++; }else{ for(var otherKey in this.entries){ delete this.entries[otherKey]; break; } } } this.entries[key] = val; } remove(key){ if(this.entries[key] !== undefined){ delete this.entries[key]; this.count--; } } get(key){ return this.entries[key]; } allEntries(){ return this.entries; } } export class SpamTable{ }