diff options
author | Mathieu Velten <mathieuv@matrix.org> | 2022-08-11 14:26:40 +0200 |
---|---|---|
committer | Mathieu Velten <mathieuv@matrix.org> | 2022-08-12 16:20:26 +0200 |
commit | 941ab4b483e24997106e2478e37057450c4f9c14 (patch) | |
tree | b583812cce5c928935e234e52e5910ea36de0a68 /synapse/storage/_base.py | |
parent | Add test for account validity feature (diff) | |
download | synapse-mv/test-account-validity.tar.xz |
Add cache invalidation to module API github/mv/test-account-validity mv/test-account-validity
Diffstat (limited to 'synapse/storage/_base.py')
-rw-r--r-- | synapse/storage/_base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/synapse/storage/_base.py b/synapse/storage/_base.py index e30f9c76d4..3f85a33344 100644 --- a/synapse/storage/_base.py +++ b/synapse/storage/_base.py @@ -95,7 +95,7 @@ class SQLBaseStore(metaclass=ABCMeta): def _attempt_to_invalidate_cache( self, cache_name: str, key: Optional[Collection[Any]] - ) -> None: + ) -> bool: """Attempts to invalidate the cache of the given name, ignoring if the cache doesn't exist. Mainly used for invalidating caches on workers, where they may not have the cache. @@ -115,7 +115,7 @@ class SQLBaseStore(metaclass=ABCMeta): except AttributeError: # We probably haven't pulled in the cache in this worker, # which is fine. - return + return False if key is None: cache.invalidate_all() @@ -125,6 +125,8 @@ class SQLBaseStore(metaclass=ABCMeta): invalidate_method = getattr(cache, "invalidate_local", cache.invalidate) invalidate_method(tuple(key)) + return True + def db_to_json(db_content: Union[memoryview, bytes, bytearray, str]) -> Any: """ |