mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-03 03:12:31 +00:00
Merge pull request #2121 from PR0M3TH3AN/perf/optimize-profile-cache-clear-12083998581018615887
⚡ Optimize ProfileCache.clearMemoryCache to O(1)
This commit is contained in:
1 file changed
+5
-1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user