Merge pull request #2121 from PR0M3TH3AN/perf/optimize-profile-cache-clear-12083998581018615887

⚡ Optimize ProfileCache.clearMemoryCache to O(1)
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-02-05 15:33:05 -05:00
commit 6844281447
1 file changed
+5 -1
+5 -1
View File
@@ -367,8 +367,12 @@ class ProfileCache {
return userCache ? userCache.get(section) : undefined;
}
/**
* Clears all cached data for a specific public key from memory.
* This operation is O(1) thanks to the nested map structure.
* @param {string} pubkey - The hex public key to clear.
*/
clearMemoryCache(pubkey) {
// Optimized: O(1) deletion using nested Map (pubkey -> section -> data)
this.memoryCache.delete(pubkey);
}