Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Add/use AsyncLruCache.invalidate_local method
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Jul 14, 2022
1 parent 27b25e1 commit 037d84f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion synapse/storage/databases/main/events_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ async def _invalidate_get_event_cache(self, event_id: str) -> None:
self._invalidate_local_get_event_cache(event_id)

def _invalidate_local_get_event_cache(self, event_id: str) -> None:
self._get_event_cache.lru_cache.invalidate((event_id,))
self._get_event_cache.invalidate_local((event_id,))
self._event_ref.pop(event_id, None)
self._current_event_fetches.pop(event_id, None)

Expand Down
3 changes: 3 additions & 0 deletions synapse/util/caches/lrucache.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,9 @@ async def set(self, key: KT, value: VT) -> None:
async def invalidate(self, key: KT) -> None:
return self.lru_cache.invalidate(key)

def invalidate_local(self, key: KT) -> None:
return self.lru_cache.invalidate(key)

async def contains(self, key: KT) -> bool:
return self.lru_cache.contains(key)

Expand Down

0 comments on commit 037d84f

Please sign in to comment.