LRUCache#

class caput.util.arraytools.LRUCache(size_bytes: int)[source]#

Bases: cachetools.LRUCache

An LRU cache for numpy arrays that will expand to a maximum size in bytes.

This should be used like a dictionary except that the least recently used entries are evicted to restrict memory usage to the specified maximum.

Parameters:
size_bytesint

The maximum size of the cache in bytes.