cache

  • full name: tenpy.tools.cache

  • parent module: tenpy.tools

  • type: module

Classes

Inheritance diagram of tenpy.tools.cache

CacheFile(storage)

Subclass of DictCache to handle opening and closing resources.

DictCache(storage)

Cache with dict-like interface.

Hdf5Storage(h5group)

Subclass of Storage which saves long-term data on disk with h5py.

PickleStorage(directory)

Subclass of Storage which saves long-term data on disk with pickle.

Storage()

A container interface for saving data to disk.

ThreadedStorage(worker, disk_storage)

Wrapper around a Storage (or subclass) with thread-parallelization.

Module description

Tools to temporarily cache parts of data to disk in order to free RAM.

The DictCache provides a dictionary-like interface to handle saving some data to disk. While the DictCache itself actually keeps everything in memory, the subclasses store the provided data to disk for future lookup in order to free memory. Any cache should be handled like a file object that needs to be closed after use; this is easiest done through a with statement, see the example in DictCache.