(self, key, value)
| 11 | self._label = label or self._cache_dir |
| 12 | |
| 13 | def __setitem__(self, key, value): |
| 14 | if value is None: |
| 15 | debug(f'Cache value for {key} should not be set to {value}') |
| 16 | return |
| 17 | |
| 18 | path = os.path.join(self._cache_dir, key) |
| 19 | |
| 20 | os.makedirs(os.path.dirname(path), exist_ok=True) |
| 21 | with open(os.path.join(self._cache_dir, key), 'w') as f: |
| 22 | f.write(value) |
| 23 | debug(f'Wrote {key} to {self._label}') |
| 24 | |
| 25 | def __getitem__(self, key): |
| 26 | if os.path.isfile(os.path.join(self._cache_dir, key)): |