/** * Remove all cached entries that match the pattern * * @param {String} pattern * @param {Function} fn */ removeByPattern(pattern, fn = noop) { let total = this.client.itemCount, count = 0 this.client.forEach((value, key) => { if (key.match(pattern)) { this.remove(key, (e) => { if (e) return fn(e) }) } if (++count === total) { fn(null) } }) }