Storage

Inheritance Diagram

Inheritance diagram of tenpy.tools.cache.Storage

Methods

Storage.__init__()

Storage.close()

Close opened files, free memory and clean up temporary files/directories.

Storage.delete(key)

Interface for cleaning up a previously saved data from disk in subclasses.

Storage.load(key)

Interface for loading data from disk in subclasses.

Storage.open([delete])

Storage.preload(key)

Interface for preloading data into the given dictionary into.

Storage.save(key, val)

Interface for saving data to disk in subclasses.

Storage.subcontainer(name)

Create another instance of the same class saving in a subdirectory/subgroup.

Class Attributes and Properties

Storage.trivial

Whether the storage is actually kept in memory, instead of saving to disk.

class tenpy.tools.cache.Storage[source]

Bases: object

A container interface for saving data to disk.

Subclasses implement different methods for save() and load(). The vanilla Storage class is “trivial” in the sense that it actually doesn’t save the data to disk, but keeps explicit references in RAM.

trivial = True

Whether the storage is actually kept in memory, instead of saving to disk.

close()[source]

Close opened files, free memory and clean up temporary files/directories.

subcontainer(name)[source]

Create another instance of the same class saving in a subdirectory/subgroup.

This method allows multiple DictCache instance re-using open resources. Subcontainers will explicitly be closed when any of the parent containers (on which subcontainer() was called) is closed.

load(key)[source]

Interface for loading data from disk in subclasses.

save(key, val)[source]

Interface for saving data to disk in subclasses.

delete(key)[source]

Interface for cleaning up a previously saved data from disk in subclasses.

preload(key)[source]

Interface for preloading data into the given dictionary into.

Only overridden in ThreadedStorage for thread-parallelized pre-loading; in other cases it does nothing.