class_docstr: Implements the public st.cache_resource API: the @st.cache_resource decorator,
  and st.cache_resource.clear().
docstr: Create a CacheResourceAPI instance.
  
  Parameters
  ----------
  decorator_metric_name
      The metric name to record for decorator usage. `@st.experimental_singleton` is
      deprecated, but we're still supporting it and tracking its usage separately
      from `@st.cache_resource`.
  
  deprecation_warning
      An optional deprecation warning to show when the API is accessed.
docstr_tok: ["Create","a","CacheResourceAPI","instance",".","Parameters","--","--","--","--","--","decorator_metric_name","The","metric","name","to","record","for","decorator","usage",".","`","@","st.experimental_singleton","`","is","deprecated",",","but","we","'re","still","supporting","it","and","tracking","its","usage","separately","from","`","@","st.cache_resource","`",".","deprecation_warning","An","optional","deprecation","warning","to","show","when","the","API","is","accessed","."]
code: def __init__(
      self,
      decorator_metric_name: str,
      deprecation_warning: str | None = None,
  ):
      """Create a CacheResourceAPI instance.
  
      Parameters
      ----------
      decorator_metric_name
          The metric name to record for decorator usage. `@st.experimental_singleton` is
          deprecated, but we're still supporting it and tracking its usage separately
          from `@st.cache_resource`.
  
      deprecation_warning
          An optional deprecation warning to show when the API is accessed.
      """
  
      # Parameterize the decorator metric name.
      # (Ignore spurious mypy complaints - https://github.com/python/mypy/issues/2427)
      self._decorator = gather_metrics(decorator_metric_name, self._decorator)  # type: ignore
      self._deprecation_warning = deprecation_warning
  
imports: from __future__ import annotations
  import math
  import threading
  import types
  from datetime import timedelta
  from typing import Any, Callable, TypeVar, cast, overload
  from cachetools import TTLCache
  from typing_extensions import TypeAlias
  import streamlit
  from streamlit.deprecation_util import show_deprecation_warning
  from streamlit.logger import get_logger
  from streamlit.runtime.caching import cache_utils
  from streamlit.runtime.caching.cache_errors import CacheKeyNotFoundError
  from streamlit.runtime.caching.cache_type import CacheType
  from streamlit.runtime.caching.cache_utils import Cache, CachedFuncInfo, make_cached_func_wrapper, ttl_to_seconds
  from streamlit.runtime.caching.cached_message_replay import CachedMessageReplayContext, CachedResult, ElementMsgData, MsgData, MultiCacheResults
  from streamlit.runtime.caching.hashing import HashFuncsDict
  from streamlit.runtime.metrics_util import gather_metrics
  from streamlit.runtime.scriptrunner.script_run_context import get_script_run_ctx
  from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
  from streamlit.vendor.pympler.asizeof import asizeof
label_desc: Use image node_id 1 to create a new CacheResourceAPI object  with example: obj = CacheResourceAPI(decorator_metric_name, deprecation_warning)