dyncache package

Module contents

dyncache.dyncache module

class dyncache.dyncache.Cache(*args, **kwargs)

Bases: object

Dynamic input-output caching for deterministic functions.

Parameters
  • root (str or None) – A folder in which to save the cache file.

  • filename (str or None) – File name for the cache, the default is “<function_name>.dyncache”

  • largeitems (bool) – In case the function takes in or returns large values, this should be toggled on or cache reading/writing performance will suffer.

  • autowrite (bool) – Whether or not the cache should automatically be written on new items. Alternatively there is cacheinstance.write() for manual writing.

read()

Read the cache file.

write()

Write the cache file.

exception dyncache.dyncache.FunctionHashMismatch

Bases: Exception

Internal exception that is raised when function has changed and the cache should be invalidated.