diff --git a/synapse/config/cache.py b/synapse/config/cache.py
index cc5ca41417..1ffb3d17e1 100644
--- a/synapse/config/cache.py
+++ b/synapse/config/cache.py
@@ -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"))