class_docstr: A cache of ForwardMsgs.
  
  Large ForwardMsgs (e.g. those containing big DataFrame payloads) are
  stored in this cache. The server can choose to send a ForwardMsg's hash,
  rather than the message itself, to a client. Clients can then
  request messages from this cache via another endpoint.
  
  This cache is *not* thread safe. It's intended to only be accessed by
  the server thread.
class_docstr_tok: ["A","cache","of","ForwardMsgs",".","Large","ForwardMsgs","(","e.g",".","those","containing","big","DataFrame","payloads",")","are","stored","in","this","cache",".","The","server","can","choose","to","send","a","ForwardMsg","'s","hash",",","rather","than","the","message","itself",",","to","a","client",".","Clients","can","then","request","messages","from","this","cache","via","another","endpoint",".","This","cache","is","*","not","*","thread","safe",".","It","'s","intended","to","only","be","accessed","by","the","server","thread","."]
docstr: Remove any cached messages that have expired from the given session.
  
  This should be called each time a AppSession finishes executing.
  
  Parameters
  ----------
  session : AppSession
  script_run_count : int
      The number of times the session's script has run
docstr_tok: ["Remove","any","cached","messages","that","have","expired","from","the","given","session",".","This","should","be","called","each","time","a","AppSession","finishes","executing",".","Parameters","--","--","--","--","--","session",":","AppSession","script_run_count",":","int","The","number","of","times","the","session","'s","script","has","run"]
code: def remove_expired_entries_for_session(
      self, session: "AppSession", script_run_count: int
  ) -> None:
      """Remove any cached messages that have expired from the given session.
  
      This should be called each time a AppSession finishes executing.
  
      Parameters
      ----------
      session : AppSession
      script_run_count : int
          The number of times the session's script has run
  
      """
      max_age = config.get_option("global.maxCachedMessageAge")
  
      # Operate on a copy of our entries dict.
      # We may be deleting from it.
      for msg_hash, entry in self._entries.copy().items():
          if not entry.has_session_ref(session):
              continue
  
          age = entry.get_session_ref_age(session, script_run_count)
          if age > max_age:
              LOGGER.debug(
                  "Removing expired entry [session=%s, hash=%s, age=%s]",
                  id(session),
                  msg_hash,
                  age,
              )
              entry.remove_session_ref(session)
              if not entry.has_refs():
                  # The entry has no more references. Remove it from
                  # the cache completely.
                  del self._entries[msg_hash]
  
imports: import hashlib
  from typing import TYPE_CHECKING, Dict, List, MutableMapping, Optional
  from weakref import WeakKeyDictionary
  from streamlit import config, util
  from streamlit.logger import get_logger
  from streamlit.proto.ForwardMsg_pb2 import ForwardMsg
  from streamlit.runtime.stats import CacheStat, CacheStatsProvider, group_stats
  from streamlit.util import HASHLIB_KWARGS
label_desc: Use image node_id 7 for calling the ForwardMsgCache obj's underlying member method code with example usage: obj.remove_expired_entries_for_session(session, script_run_count) without return types