-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor cache system #154
Conversation
if Path(self.problemset_dir / "cache.json").exists(): | ||
reference_problemset_cache = json.load( | ||
open(self.problemset_dir / "cache.json") | ||
cache = RenderResultCache(self.problemset_dir, output_ext) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
問題セットのキャッシュファイルは構造が変わるが、許容する
output_ext=output_ext, | ||
problem_ids=valid_problem_ids, | ||
is_problemset=True, | ||
force_dump=force_dump or has_diff, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
どれかの問題で差分が発生していたら、problemset が更新される
(以前は cache の中身で判定していたが、判定方法を変更)
cache = self._load_cache() | ||
return self._setup_cache(cache) | ||
|
||
def _cleanup(self, cache: dict) -> dict: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ここで行っているのは、以下の 2 つ
- 不要になった id を列挙し、キャッシュの辞書から削除
- 不要になった id に関係あるファイルを列挙し、ファイルを削除
やや非自明で、一応コメントがあるといいかもだけど、これくらいならなくても読める気もする。
Resolves #150
キャッシュ機構をリファクタリング