UNPKG

diffusion

Version:

Diffusion JavaScript client

21 lines (17 loc) 478 B
var canonicalise = require('topics/topic-path-utils').canonicalise; module.exports = function ValueCache() { var cache = {}; this.get = function(path) { return cache[canonicalise(path)]; }; this.put = function(path, value) { cache[canonicalise(path)] = value; }; this.remove = function(selector) { for (var k in cache) { if (selector.selects(k)) { delete cache[k]; } } }; };