pyphi.cache.content.ContentCache#
- class pyphi.cache.content.ContentCache(name)[source]#
Bases:
object- Parameters:
name (str)
- get_or_compute(fingerprint, args, compute, *, store=True)[source]#
Return the cached value for
(fingerprint, args), else compute it.On a miss,
computeis called and its result returned. An exception fromcomputepropagates and no entry is added. The result is stored whenstoreis true, evicting least recently used entries to stay within the cache’s byte bound once resident memory has reached the configured ceiling.A hit reinserts its entry, which moves it to the recent end of the backing dict’s iteration order.
The hit path is lock-free; the
hitsandmissescounters it updates are best-effort under free-threaded Python.