| 18 | self._lock = asyncio.Lock() |
| 19 | |
| 20 | async def get(self, path: str, *, read_through: bool = True) -> str | None: |
| 21 | abs_path = os.path.abspath(path) |
| 22 | async with self._lock: |
| 23 | if abs_path in self._cache: |
| 24 | self._cache.move_to_end(abs_path) |
| 25 | return self._cache[abs_path] |
| 26 | |
| 27 | if not read_through: |
| 28 | return None |
| 29 | |
| 30 | content = await self._read_file(abs_path) |
| 31 | if content is not None: |
| 32 | await self.set(abs_path, content) |
| 33 | return content |
| 34 | |
| 35 | async def set(self, path: str, content: str) -> None: |
| 36 | abs_path = os.path.abspath(path) |