Move _DEFAULT_CONFIG to class method

pull/6391/head
Andrew Morgan 2020-04-03 18:00:53 +01:00
parent 4ed7aa1b34
commit be0737adc3
1 changed files with 17 additions and 16 deletions

View File

@ -31,22 +31,6 @@ CACHE_PROPERTIES = {
"ensure_correct_cache_sizing": None,
}
_DEFAULT_CONFIG = """\
# Cache configuration
#
# 'global_factor' controls the global cache factor. This overrides the
# "SYNAPSE_CACHE_FACTOR" environment variable.
#
# 'per_cache_factors' is a dictionary of cache name to cache factor for that
# individual cache.
#
#caches:
# global_factor: 0.5
# per_cache_factors:
# get_users_who_share_room_with_user: 2
#
"""
def add_resizable_cache(cache_name, cache_resize_callback):
_CACHES[cache_name.lower()] = cache_resize_callback
@ -64,6 +48,23 @@ class CacheConfig(Config):
CACHE_PROPERTIES["ensure_correct_cache_sizing"] = None
_CACHES.clear()
def generate_config_section(self, **kwargs):
return """\
# Cache configuration
#
# 'global_factor' controls the global cache factor. This overrides the
# "SYNAPSE_CACHE_FACTOR" environment variable.
#
# 'per_cache_factors' is a dictionary of cache name to cache factor for that
# individual cache.
#
#caches:
# global_factor: 0.5
# per_cache_factors:
# get_users_who_share_room_with_user: 2
#
"""
def read_config(self, config, **kwargs):
self.event_cache_size = self.parse_size(config.get("event_cache_size", "10K"))