Skip to content

Instantly share code, notes, and snippets.

@digitalconceptvisuals
Created July 29, 2020 22:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save digitalconceptvisuals/6a95e30af3119b6e710f63c821f9a2df to your computer and use it in GitHub Desktop.
Save digitalconceptvisuals/6a95e30af3119b6e710f63c821f9a2df to your computer and use it in GitHub Desktop.
set(key, value) {
let result = super.set(key, value);
// Update the frequency of the key
this.#updateFrequency(key);
return result;
}
get(key) {
let exists = super.get(key);
// Don't update non existing gets
if (exists)
this.#updateFrequency(key);
return exists;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment