Package instant :: Module cache
[hide private]
[frames] | no frames]

Module cache

source code

This module contains helper functions for working with the module cache.

Example operations:

Functions [hide private]
 
modulename_from_checksum(checksum)
Construct a module name from a checksum for use in cache.
source code
 
checksum_from_modulename(modulename)
Construct a module name from a checksum for use in cache.
source code
 
import_module_directly(path, modulename)
Import a module with the given module name that resides in the given path.
source code
 
memory_cached_module(moduleid)
Returns the cached module if found.
source code
 
place_module_in_memory_cache(moduleid, module)
Place a compiled module in cache with given id.
source code
 
is_valid_module_name(name) source code
 
import_and_cache_module(path, modulename, moduleids) source code
 
check_memory_cache(moduleid) source code
 
check_disk_cache(modulename, cache_dir, moduleids) source code
 
import_module(moduleid, cache_dir=None)
Import module from cache given its moduleid and an optional cache directory.
source code
 
cached_modules(cache_dir=None)
Return a list with the names of all cached modules.
source code
Variables [hide private]
  _modulename_prefix = 'instant_module_'
  _memory_cache = {}
  __package__ = 'instant'
Function Details [hide private]

import_module(moduleid, cache_dir=None)

source code 

Import module from cache given its moduleid and an optional cache directory.

The moduleid can be either

  • the module name
  • a signature string, of which a checksum is taken to look up in the cache
  • a checksum string, which is used directly to look up in the cache
  • a hashable non-string object with a function moduleid.signature() which is used to get a signature string

The hashable object is used to look up in the memory cache before signature() is called. If the module is found on disk, it is placed in the memory cache.