mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
Optimize clearMemoryCache to O(1) using nested map structure
Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
b32c3dc39f
commit
0073bf223b
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 due to nested map structure
|
||||
this.memoryCache.delete(pubkey);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user