5151from synapse .config import cache as cache_config
5252from synapse .metrics .background_process_metrics import wrap_as_background_process
5353from synapse .util import Clock , caches
54- from synapse .util .caches import CacheManager , CacheMetric , EvictionReason
54+ from synapse .util .caches import CacheMetric , EvictionReason
5555from synapse .util .caches .treecache import (
5656 TreeCache ,
5757 iterate_tree_cache_entry ,
@@ -379,44 +379,11 @@ class LruCache(Generic[KT, VT]):
379379 If cache_type=TreeCache, all keys must be tuples.
380380 """
381381
382- # If you're providing in the `cache_name`, then you must provide the `cache_manager`
383- @overload
384- def __init__ (
385- self ,
386- max_size : int ,
387- * ,
388- cache_name : str ,
389- cache_manager : CacheManager ,
390- metrics_collection_callback : Optional [Callable [[], None ]] = None ,
391- cache_type : Type [Union [dict , TreeCache ]] = dict ,
392- size_callback : Optional [Callable [[VT ], int ]] = None ,
393- apply_cache_factor_from_config : bool = True ,
394- clock : Optional [Clock ] = None ,
395- prune_unread_entries : bool = True ,
396- extra_index_cb : Optional [Callable [[KT , VT ], KT ]] = None ,
397- ): ...
398-
399- # If you're *not* providing in the `cache_name`, then you shouldn't provide the
400- # `cache_manager` or the `metrics_collection_callback`
401- @overload
402- def __init__ (
403- self ,
404- max_size : int ,
405- * ,
406- cache_type : Type [Union [dict , TreeCache ]] = dict ,
407- size_callback : Optional [Callable [[VT ], int ]] = None ,
408- apply_cache_factor_from_config : bool = True ,
409- clock : Optional [Clock ] = None ,
410- prune_unread_entries : bool = True ,
411- extra_index_cb : Optional [Callable [[KT , VT ], KT ]] = None ,
412- ): ...
413-
414382 def __init__ (
415383 self ,
416384 max_size : int ,
417385 * ,
418386 cache_name : Optional [str ] = None ,
419- cache_manager : Optional [CacheManager ] = None ,
420387 metrics_collection_callback : Optional [Callable [[], None ]] = None ,
421388 cache_type : Type [Union [dict , TreeCache ]] = dict ,
422389 size_callback : Optional [Callable [[VT ], int ]] = None ,
@@ -432,9 +399,6 @@ def __init__(
432399 cache_name: The name of this cache, for the prometheus metrics. If unset,
433400 no metrics will be reported on this cache.
434401
435- cache_manager: The cache manager to handle metrics. If unset, no metrics will be
436- reported on this cache.
437-
438402 Ignored if `cache_name` is `None`.
439403
440404 metrics_collection_callback:
@@ -499,15 +463,17 @@ def __init__(
499463 # do yet when we get resized.
500464 self ._on_resize : Optional [Callable [[], None ]] = None
501465
502- if cache_name is not None :
503- metrics : Optional [CacheMetric ] = cache_manager .register_cache (
504- "lru_cache" ,
505- cache_name ,
506- self ,
507- collect_callback = metrics_collection_callback ,
508- )
509- else :
510- metrics = None
466+ # TODO
467+ # if cache_name is not None:
468+ # metrics: Optional[CacheMetric] = cache_manager.register_cache(
469+ # "lru_cache",
470+ # cache_name,
471+ # self,
472+ # collect_callback=metrics_collection_callback,
473+ # )
474+ # else:
475+ # metrics = None
476+ metrics : Optional [CacheMetric ] = None
511477
512478 # this is exposed for access from outside this class
513479 self .metrics = metrics
0 commit comments