Move _DEFAULT_CONFIG to class method
parent
4ed7aa1b34
commit
be0737adc3
|
@ -31,22 +31,6 @@ CACHE_PROPERTIES = {
|
||||||
"ensure_correct_cache_sizing": None,
|
"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):
|
def add_resizable_cache(cache_name, cache_resize_callback):
|
||||||
_CACHES[cache_name.lower()] = cache_resize_callback
|
_CACHES[cache_name.lower()] = cache_resize_callback
|
||||||
|
@ -64,6 +48,23 @@ class CacheConfig(Config):
|
||||||
CACHE_PROPERTIES["ensure_correct_cache_sizing"] = None
|
CACHE_PROPERTIES["ensure_correct_cache_sizing"] = None
|
||||||
_CACHES.clear()
|
_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):
|
def read_config(self, config, **kwargs):
|
||||||
self.event_cache_size = self.parse_size(config.get("event_cache_size", "10K"))
|
self.event_cache_size = self.parse_size(config.get("event_cache_size", "10K"))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue