-
-
Save digitalconceptvisuals/0a2c2c0801657579ca62efaeb5990ebf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// if key was accessed, increment its frequency | |
#updateFrequency = key => { | |
let frequencyObject = this.#frequencyMap.get(key); | |
// if existing key, update the frequency | |
if (frequencyObject) | |
frequencyObject.update(); | |
else | |
this.#frequencyMap.set(key, frequencyObject = new Frequency()); | |
debug(`Updated { ${key} => ${frequencyObject} }`); | |
// Maybe we went over the maxSize, truncate the Map | |
this.#resizeMap(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment