class_docstr: Used to track state between levels of recursion to stop infinite loops, and to optimise repeating actions
class_docstr_tok: ["Used","to","track","state","between","levels","of","recursion","to","stop","infinite","loops",",","and","to","optimise","repeating","actions"]
code: def get_or_update(
      self, ctext: Any, keyname: str, get_value: Callable[[], Any]
  ):
      # Should have been marked first
      target = self._cache[ctext]
      res = target.get(keyname)
      if res is not None:
          return res
  
      val = get_value()
      target[keyname] = val
      return val
  
imports: import datetime
  import os
  import pydoc
  from typing import Any, Callable, Dict, List, Optional, Type, Union
  import appdirs
  import yaml
  import logging
  from rich.logging import RichHandler
  from .None import _fwd
  from ._modules import PolymorphicChecker, ResourceLoader, Searcher
label_desc: Use image node_id 3 for calling the Cache obj's underlying member method code with example usage: obj.get_or_update(ctext, keyname, get_value) and returns: val, res