初始化本地缓存数据管理类 :param scm_url: 项目的url,作为项目区分的唯一主键
(self, scm_url, src_type='normal')
| 22 | exist_file = False |
| 23 | |
| 24 | def __init__(self, scm_url, src_type='normal'): |
| 25 | ''' |
| 26 | 初始化本地缓存数据管理类 |
| 27 | :param scm_url: 项目的url,作为项目区分的唯一主键 |
| 28 | ''' |
| 29 | CacheBase.__init__(self, scm_url, src_type) |
| 30 | if os.path.exists(self.cache_file): |
| 31 | self.exist_file = True |
| 32 | with open(self.cache_file, 'r') as cache_file: |
| 33 | cache_text = cache_file.read() |
| 34 | try: |
| 35 | self.cache_data = json.loads(cache_text) |
| 36 | except Exception as err: |
| 37 | LogPrinter.warning(f"load {self.cache_file} error: {str(err)}") |
| 38 | LogPrinter.warning(f"cache file text: {cache_text}") |
| 39 | self.cache_data = [] |
| 40 | for issue in self.cache_data: |
| 41 | if issue['scm_url'] == self.scm_url and issue['src_type'] == self.src_type: |
| 42 | self.path_dict = issue['path_dict'] |
| 43 | self.exist_cache = True |
| 44 | for path in self.path_dict.values(): |
| 45 | if not os.path.exists(path): |
| 46 | self.exist_cache = False |
| 47 | break |
| 48 | |
| 49 | def insert_cache(self, path_dict): |
| 50 | """ |