(self, key: str, type: CacheType, filetype=None)
| 115 | return full_path.exists(), full_path |
| 116 | |
| 117 | def get(self, key: str, type: CacheType, filetype=None): |
| 118 | full_path = self.path(key, type, filetype) |
| 119 | if not full_path.exists(): |
| 120 | return None |
| 121 | try: |
| 122 | with open(full_path, "r") as f: |
| 123 | if filetype == "json": |
| 124 | return json.load(f) |
| 125 | return f.read() |
| 126 | except Exception as e: |
| 127 | logger.error(e) |
| 128 | return None |
| 129 | |
| 130 | def set(self, key: str, type: CacheType, data: Any, filetype=None): |
| 131 | full_path = self.path(key, type, filetype) |
no test coverage detected