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

Commit f510fba

Browse files
author
David Robertson
authored
Describe prune_unread_entries in docstrings (#11876)
Should have been caught in #10826.
1 parent acda9f0 commit f510fba

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

changelog.d/11876.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve internal docstrings in `synapse.util.caches`.

synapse/util/caches/deferred_cache.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,14 @@ def __init__(
8181
Args:
8282
name: The name of the cache
8383
max_entries: Maximum amount of entries that the cache will hold
84-
keylen: The length of the tuple used as the cache key. Ignored unless
85-
`tree` is True.
8684
tree: Use a TreeCache instead of a dict as the underlying cache type
8785
iterable: If True, count each item in the cached object as an entry,
8886
rather than each cached object
8987
apply_cache_factor_from_config: Whether cache factors specified in the
9088
config file affect `max_entries`
89+
prune_unread_entries: If True, cache entries that haven't been read recently
90+
will be evicted from the cache in the background. Set to False to
91+
opt-out of this behaviour.
9192
"""
9293
cache_type = TreeCache if tree else dict
9394

synapse/util/caches/descriptors.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,17 @@ def foo(self, key, cache_context):
254254
return r1 + r2
255255
256256
Args:
257+
orig:
258+
max_entries:
257259
num_args: number of positional arguments (excluding ``self`` and
258260
``cache_context``) to use as cache keys. Defaults to all named
259261
args of the function.
262+
tree:
263+
cache_context:
264+
iterable:
265+
prune_unread_entries: If True, cache entries that haven't been read recently
266+
will be evicted from the cache in the background. Set to False to opt-out
267+
of this behaviour.
260268
"""
261269

262270
def __init__(

synapse/util/caches/lrucache.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,12 @@ def __init__(
340340
341341
apply_cache_factor_from_config (bool): If true, `max_size` will be
342342
multiplied by a cache factor derived from the homeserver config
343+
344+
clock:
345+
346+
prune_unread_entries: If True, cache entries that haven't been read recently
347+
will be evicted from the cache in the background. Set to False to
348+
opt-out of this behaviour.
343349
"""
344350
# Default `clock` to something sensible. Note that we rename it to
345351
# `real_clock` so that mypy doesn't think its still `Optional`.

0 commit comments

Comments
 (0)