class_docstr: Manages cached values for a single st.cache_resource function.
docstr: Read a value and associated messages from the cache.
  Raise `CacheKeyNotFoundError` if the value doesn't exist.
docstr_tok: ["Read","a","value","and","associated","messages","from","the","cache",".","Raise","`","CacheKeyNotFoundError","`","if","the","value","does","n't","exist","."]
code: def read_result(self, key: str) -> CachedResult:
      """Read a value and associated messages from the cache.
      Raise `CacheKeyNotFoundError` if the value doesn't exist.
      """
      with self._mem_cache_lock:
          if key not in self._mem_cache:
              # key does not exist in cache.
              raise CacheKeyNotFoundError()
  
          multi_results: MultiCacheResults = self._mem_cache[key]
  
          ctx = get_script_run_ctx()
          if not ctx:
              # ScriptRunCtx does not exist (we're probably running in "raw" mode).
              raise CacheKeyNotFoundError()
  
          widget_key = multi_results.get_current_widget_key(
              ctx, CacheType.RESOURCE
          )
          if widget_key not in multi_results.results:
              # widget_key does not exist in cache (this combination of widgets hasn't been
              # seen for the value_key yet).
              raise CacheKeyNotFoundError()
  
          result = multi_results.results[widget_key]
  
          if self.validate is not None and not self.validate(
              result.value
          ):
              # Validate failed: delete the entry and raise an error.
              del multi_results.results[widget_key]
              raise CacheKeyNotFoundError()
  
          return result
  
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 4 for calling the ResourceCache obj's underlying member method code with example usage: obj.read_result(key) and returns: result