提交 49e6f8c3 authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Updated doc to take into account changes to cache mechanism

上级 7d63eaef
...@@ -302,24 +302,32 @@ class ModuleCache(object): ...@@ -302,24 +302,32 @@ class ModuleCache(object):
It is built to handle the case where multiple programs are also using instances of this It is built to handle the case where multiple programs are also using instances of this
class to manage the same directory. class to manage the same directory.
The cache works on the basis of keys. Each key is mapped to only one
dynamic module, but multiple keys may be mapped to the same module (see
below for details).
The cache works on the basis of keys. Keys are used to uniquely identify a dynamic module.
Keys should be tuples of length 2: (version, rest) Keys should be tuples of length 2: (version, rest)
The ``rest`` can be anything hashable and picklable, that uniquely identifies the The ``rest`` can be anything hashable and picklable, that uniquely identifies the
computation in the module. computation in the module.
The ``version`` should be a hierarchy of tuples of integers. The ``version`` should be a hierarchy of tuples of integers.
If the ``version`` is either 0 or (), then the corresponding module is unversioned, and If the ``version`` is either 0 or (), then the key is unversioned, and its
will be deleted in an atexit() handler. corresponding module will be deleted in an atexit() handler if it is not
If the ``version`` is neither 0 nor (), then the module will be kept in the cache between associated to another versioned key.
processes. If the ``version`` is neither 0 nor (), then the module will be kept in the
cache between processes.
An unversioned module is not deleted by the process that creates it. Deleting such modules An unversioned module is not deleted by the process that creates it. Deleting such modules
does not work on NFS filesystems because the tmpdir in which the library resides is in use does not work on NFS filesystems because the tmpdir in which the library resides is in use
until the end of the process' lifetime. Instead, unversioned modules are left in their until the end of the process' lifetime. Instead, unversioned modules are left in their
tmpdirs without corresponding .pkl files. These modules and their directories are erased tmpdirs without corresponding .pkl files. These modules and their directories are erased
by subsequent processes' refresh() functions. by subsequent processes' refresh() functions.
Two different keys are mapped to the same module when:
- They have the same version.
- They share the same compilation options in their ``rest`` part (see
``CLinker.cmodule_key_`` for how this part is built).
- They share the same C code.
""" """
dirname = "" dirname = ""
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论