diff options
author | Erik Johnston <erik@matrix.org> | 2023-12-13 15:41:11 +0000 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2023-12-13 15:41:11 +0000 |
commit | 8613f7693ea284a023dc625c9a35b9ff482f5fd0 (patch) | |
tree | 910f686e8c8e5fde00808b9289b0e57b23229b99 /docs/modules | |
parent | Update nightly jobs to run on element-hq/synapse. (diff) | |
download | synapse-8613f7693ea284a023dc625c9a35b9ff482f5fd0.tar.xz |
More renaming
Diffstat (limited to 'docs/modules')
-rw-r--r-- | docs/modules/writing_a_module.md | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/docs/modules/writing_a_module.md b/docs/modules/writing_a_module.md index b99f64b9d8..f1b2bef3fa 100644 --- a/docs/modules/writing_a_module.md +++ b/docs/modules/writing_a_module.md @@ -10,7 +10,7 @@ either the output of the module's `parse_config` static method (see below), or t configuration associated with the module in Synapse's configuration file. See the documentation for the `ModuleApi` class -[here](https://github.com/matrix-org/synapse/blob/master/synapse/module_api/__init__.py). +[here](https://github.com/element.-hq/synapse/blob/master/synapse/module_api/__init__.py). ## When Synapse runs with several modules configured @@ -109,7 +109,7 @@ from synapse.module_api import cached, ModuleApi class MyModule: def __init__(self, config: Any, api: ModuleApi): self.api = api - + # Register the cached function so Synapse knows how to correctly invalidate # entries for it. self.api.register_cached_function(self.get_user_from_id) @@ -124,15 +124,15 @@ class MyModule: async def do_something_with_users(self) -> None: """Calls the cached function and then invalidates an entry in its cache.""" - + user_id = "@alice:example.com" - + # Get the user. Since get_department_for_user is wrapped with a cache, # the return value for this user_id will be cached. department = await self.get_department_for_user(user_id) - + # Do something with `department`... - + # Let's say something has changed with our user, and the entry we have for # them in the cache is out of date, so we want to invalidate it. await self.api.invalidate_cache(self.get_department_for_user, (user_id,)) |