@staticmethod<EOL><INDENT>def parse(base_dir: str, timestamp: int = None) -> int:<DEDENT>
LOGGER.debug('<STR_LIT>', base_dir, timestamp)<EOL>if not isdir(base_dir):<EOL><INDENT>LOGGER.info('<STR_LIT>')<EOL>LOGGER.debug('<STR_LIT>')<EOL>return None<EOL><DEDENT>if not timestamp:<EOL><INDENT>timestamps = [int(t) for t in listdir(base_dir) if t.isdigit()]<EOL>if timestamps:<EOL><INDENT>timestamp = max(timestamps)<EOL><DEDENT>else:<EOL><INDENT>LOGGER.info('<STR_LIT>')<EOL>LOGGER.debug('<STR_LIT>')<EOL>return None<EOL><DEDENT><DEDENT>timestamp_dir = join(base_dir, str(timestamp))<EOL>if not isdir(timestamp_dir):<EOL><INDENT>LOGGER.error('<STR_LIT>', timestamp_dir)<EOL>LOGGER.debug('<STR_LIT>')<EOL>return None<EOL><DEDENT>with SCHEMA_CACHE.lock:<EOL><INDENT>with open(join(timestamp_dir, '<STR_LIT>'), '<STR_LIT:r>') as archive:<EOL><INDENT>schemata = json.loads(archive.read())<EOL>SCHEMA_CACHE.feed(schemata)<EOL><DEDENT><DEDENT>with CRED_DEF_CACHE.lock:<EOL><INDENT>with open(join(timestamp_dir, '<STR_LIT>'), '<STR_LIT:r>') as archive:<EOL><INDENT>cred_defs = json.loads(archive.read())<EOL>for cd_id in cred_defs:<EOL><INDENT>if cd_id in CRED_DEF_CACHE:<EOL><INDENT>LOGGER.warning('<STR_LIT>', cd_id)<EOL><DEDENT>else:<EOL><INDENT>CRED_DEF_CACHE[cd_id] = cred_defs[cd_id]<EOL>LOGGER.info('<STR_LIT>', cd_id)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>with REVO_CACHE.lock:<EOL><INDENT>with open(join(timestamp_dir, '<STR_LIT>'), '<STR_LIT:r>') as archive:<EOL><INDENT>rr_cache_entries = json.loads(archive.read())<EOL>for (rr_id, entry) in rr_cache_entries.items():<EOL><INDENT>if rr_id in REVO_CACHE:<EOL><INDENT>LOGGER.warning('<STR_LIT>', rr_id)<EOL><DEDENT>else:<EOL><INDENT>rr_cache_entry = RevoCacheEntry(entry['<STR_LIT>'])<EOL>rr_cache_entry.rr_delta_frames = [<EOL>RevRegUpdateFrame(<EOL>f['<STR_LIT>'],<EOL>f['<STR_LIT>'],<EOL>f['<STR_LIT>']) for f in entry['<STR_LIT>']<EOL>]<EOL>rr_cache_entry.cull(True)<EOL>rr_cache_entry.rr_state_frames = [<EOL>RevRegUpdateFrame(<EOL>f['<STR_LIT>'],<EOL>f['<STR_LIT>'],<EOL>f['<STR_LIT>']) for f in entry['<STR_LIT>']<EOL>]<EOL>rr_cache_entry.cull(False)<EOL>REVO_CACHE[rr_id] = rr_cache_entry<EOL>LOGGER.info('<STR_LIT>', rr_id)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>LOGGER.debug('<STR_LIT>', timestamp)<EOL>return timestamp<EOL>
Parse and update from archived cache files. Only accept new content;
do not overwrite any existing cache content.

:param base_dir: archive base directory
:param timestamp: epoch time of cache serving as subdirectory, default most recent
:return: epoch time of cache serving as subdirectory, None if there is no such archive.