gemseo.caches.memory_full_cache module#

Caching module to store all the entries in memory.

class MemoryFullCache(tolerance=0.0, name='', is_memory_shared=True)[source]#

Bases: BaseFullCache

Cache using memory to cache all the data.

Parameters:
  • is_memory_shared (bool) --

    If True, a shared memory dictionary is used to store the data, which makes the cache compatible with multiprocessing.

    By default it is set to True.

  • tolerance (float) --

    By default it is set to 0.0.

  • name (str) --

    By default it is set to "".

Warning

If is_memory_shared is False and multiple disciplines point to the same cache or the process is multi-processed, there may be duplicate computations because the cache will not be shared among the processes. This class relies on some multiprocessing features, it is therefore necessary to protect its execution with an if __name__ == '__main__': statement when working on Windows.

clear()[source]#

Clear the cache.

Return type:

None

property copy: MemoryFullCache#

Copy the current cache.

Returns:

A copy of the current cache.