-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Enable cache time-based expiry by default #11849
Changes from 6 commits
f798aba
adbd8ed
bdeaf52
83661c5
4eb3e6a
652c620
6784e1e
253edca
775cbf7
6dddbc7
8efac83
c86e536
327ea5a
8d06aac
f37e95f
3299583
77ac0d7
604145a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Enable cache time-based expiry by default. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It may be worth mentioning the new configuration options that are available, or otherwise pointing to the relevant section of the sample config for the full details. This could also be done via our upgrading docs, where we have more room. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would likely still sneak a keyword or two in there: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,11 +148,15 @@ def generate_config_section(self, **kwargs) -> str: | |
per_cache_factors: | ||
#get_users_who_share_room_with_user: 2.0 | ||
|
||
# Controls how long an entry can be in a cache without having been | ||
# accessed before being evicted. Defaults to None, which means | ||
# entries are never evicted based on time. | ||
# Controls whether cache entries are evicted after a specified time | ||
# period. Defaults to true. | ||
# expire_caches: false | ||
H-Shay marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# If expire_caches is enabled, this flag controls how long an entry can | ||
# be in a cache without having been accessed before being evicted. | ||
# Defaults to 30m. Uncomment to set a different time to live for cache entries. | ||
# | ||
#expiry_time: 30m | ||
# cache_entry_ttl: 30m | ||
|
||
# Controls how long the results of a /sync request are cached for after | ||
# a successful response is returned. A higher duration can help clients with | ||
|
@@ -217,9 +221,16 @@ def read_config(self, config, **kwargs) -> None: | |
e.message # noqa: B306, DependencyException.message is a property | ||
) | ||
|
||
expiry_time = cache_config.get("expiry_time") | ||
if expiry_time: | ||
self.expiry_time_msec: Optional[int] = self.parse_duration(expiry_time) | ||
expire_caches = cache_config.get("expire_caches", True) | ||
cache_entry_ttl = cache_config.get("cache_entry_ttl") | ||
H-Shay marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we're changing config options, we should include backwards-compatibility support for the previous config option name. Thus if someone set |
||
if expire_caches: | ||
if cache_entry_ttl: | ||
self.expiry_time_msec: Optional[int] = self.parse_duration( | ||
cache_entry_ttl | ||
) | ||
else: | ||
self.expiry_time_msec = 1800000 | ||
H-Shay marked this conversation as resolved.
Show resolved
Hide resolved
|
||
else: | ||
self.expiry_time_msec = None | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.