capytaine.tools.lru_cache module¶
Tools for memoization of functions.
- capytaine.tools.lru_cache.delete_first_lru_cache(maxsize=1)¶
Behaves mostly like functools.lru_cache(), but the oldest data in the cache is deleted before computing a new one, in order to never have more that maxsize items in memory. This is useful to limit RAM usage when stored objects are big, like the interaction matrices of Capytaine.
- capytaine.tools.lru_cache.lru_cache_with_strict_maxsize(maxsize=1)[source]¶
Behaves mostly like functools.lru_cache(), but the oldest data in the cache is deleted before computing a new one, in order to never have more that maxsize items in memory. This is useful to limit RAM usage when stored objects are big, like the interaction matrices of Capytaine.