UNPKG

@didomi/iabtcf-cmpapi

Version:

Ensures other in-page digital marketing technologies have access to CMP transparency and consent information for the iab. Transparency and Consent Framework (TCF).

28 lines (27 loc) 595 B
export class CacheBucket { name; recalculations; cache; constructor(name) { this.name = name; this.recalculations = 0; this.cache = new Map(); } get(key, recalculation, ...args) { let value = this.cache.get(key); if (value) { return value; } value = recalculation(...args); this.cache.set(key, value); this.recalculations++; return value; } clear() { this.cache.clear(); this.recalculations = 0; } size() { return this.cache.size; } }