Base module to handle extension ASCII caching.
Attributes
mlogger = get_logger(__name__)
module-attribute
Classes
Functions
update_cache(parsed_ext)
Source code in pyrevitlib/pyrevit/extensions/cacher_asc.py
| def update_cache(parsed_ext):
mlogger.debug('Updating cache for tab: %s ...', parsed_ext.name)
_write_cache_for(parsed_ext)
mlogger.debug('Cache updated for tab: %s', parsed_ext.name)
|
get_cached_extension(installed_ext)
Source code in pyrevitlib/pyrevit/extensions/cacher_asc.py
| def get_cached_extension(installed_ext):
cached_ext_dict = _read_cache_for(installed_ext)
# try:
mlogger.debug('Constructing components from cache for: %s',
installed_ext)
# get cached sub component dictionary and call recursive maker function
_make_sub_cmp_from_cache(installed_ext,
cached_ext_dict.pop(gencomps.SUB_CMP_KEY))
mlogger.debug('Load successful...')
# except Exception as err:
# mlogger.debug('Error reading cache...')
# raise PyRevitException('Error creating ext from cache for: {} | {}'
# .format(installed_ext.name, err))
return installed_ext
|
is_cache_valid(extension)
Source code in pyrevitlib/pyrevit/extensions/cacher_asc.py
| def is_cache_valid(extension):
try:
cached_ext_dict = _read_cache_for(extension) # type: dict
mlogger.debug('Extension cache directory is: %s for: %s',
extension.directory, extension)
cache_dir_valid = cached_ext_dict[gencomps.EXT_DIR_KEY] == extension.directory
mlogger.debug('Extension cache version is: %s for: %s',
extension.pyrvt_version, extension)
cache_version_valid = \
cached_ext_dict[comps.EXT_HASH_VERSION_KEY] == extension.pyrvt_version
mlogger.debug('Extension hash value is: %s for:%s',
extension.dir_hash_value, extension)
cache_hash_valid = \
cached_ext_dict[comps.EXT_HASH_VALUE_KEY] == extension.dir_hash_value
cache_valid = \
cache_dir_valid and cache_version_valid and cache_hash_valid
# cache is valid if both version and hash value match
return cache_valid
except PyRevitException as err:
mlogger.debug(err)
return False
except Exception as err:
mlogger.debug('Error determining cache validity: %s | %s',
extension, err)
|