class_docstr: Least-Recently-Used cache.
  Acts as a wrapper around an arbitrary function and caches the return values.
  
  Based on the implementation of Raymond Hettinger
  (https://stackoverflow.com/questions/2437617/limiting-the-size-of-a-python-dictionary)
  
  Parameters
  ----------
  original_function: callable
      The original function that will be wrapped. Return values will be cached.
      The function parameters have to be hashable.
  max_size: int (optional, default 10_000)
      The maximum number of elements allowed within the cache. If the size would be exceeded,
      the least recently used element will be removed from the cache.
code: def __call__(self, *key):
      mapping, head, tail = self.mapping, self.head, self.tail
  
      link = mapping.get(key, head)
      if link is head:
          # Not yet in map
          value = self.original_function(*key)
          if len(mapping) >= self.max_size:
              # Unlink the least recently used element
              old_prev, old_next, old_key, old_value = head[_NEXT]
              head[_NEXT] = old_next
              old_next[_PREV] = head
              del mapping[old_key]
          # Add new value as most recently used element
          last = tail[_PREV]
          link = [last, tail, key, value]
          mapping[key] = last[_NEXT] = tail[_PREV] = link
      else:
          # Unlink element from current position
          link_prev, link_next, key, value = link
          link_prev[_NEXT] = link_next
          link_next[_PREV] = link_prev
          # Add as most recently used element
          last = tail[_PREV]
          last[_NEXT] = tail[_PREV] = link
          link[_PREV] = last
          link[_NEXT] = tail
      return value
  
file_path: pgmpy/pgmpy/estimators/ScoreCache.py
imports: from pgmpy.estimators import StructureScore
label_desc: Use image node_id 2 for calling the LRUCache obj's underlying member method code with example usage: obj.__call__() and returns: value