| | |
| | | __CodesPlateKeysManager = CodesHisReasonAndBlocksManager() |
| | | __current_code_reason_dict = {} |
| | | __current_reason_codes_dict = {} |
| | | __records_cache = {} |
| | | |
| | | @classmethod |
| | | def __load_hist_and_blocks(cls, code): |
| | |
| | | mysqldb = mysql_data.Mysqldb() |
| | | return mysqldb.select_all(f"select * from kpl_limit_up_record where _day='{day}'") |
| | | |
| | | @classmethod |
| | | def list_all_cache(cls, day): |
| | | if day in cls.__records_cache: |
| | | return cls.__records_cache[day] |
| | | fdata = cls.list_all(day) |
| | | if fdata: |
| | | cls.__records_cache[day] = fdata |
| | | return fdata |
| | | |
| | | @staticmethod |
| | | def list_by_code(code, day): |
| | | mysqldb = mysql_data.Mysqldb() |
| | | return mysqldb.select_all(f"select * from kpl_limit_up_record where _code='{code}' and _day='{day}'") |
| | | |
| | | |
| | | @staticmethod |
| | | def list_by_block(block_name, day): |
| | |
| | | class KPLDataManager: |
| | | __latest_datas = {} |
| | | kpl_data_update_info = {} |
| | | __file_content_cache = {} |
| | | |
| | | @classmethod |
| | | def __save_in_file(cls, key, datas): |
| | |
| | | return None |
| | | |
| | | @classmethod |
| | | def get_from_file_cache(cls, type, day): |
| | | key = f"{type}-{day}" |
| | | if key in cls.__file_content_cache: |
| | | return cls.__file_content_cache.get(key) |
| | | fdata = cls.get_from_file(type, day) |
| | | if fdata: |
| | | cls.__file_content_cache[key] = fdata |
| | | return fdata |
| | | |
| | | |
| | | |
| | | @classmethod |
| | | # 获取最近几天的数据,根据日期倒序返回 |
| | | def get_latest_from_file(cls, type, count): |
| | | files = os.listdir(constant.CACHE_PATH) |