From 1647be96de59141a38dd3bd2abf97708d5ebeef9 Mon Sep 17 00:00:00 2001 From: awsr <43862868+awsr@users.noreply.github.com> Date: Sat, 11 Apr 2026 13:14:46 -0700 Subject: [PATCH] Minor function renaming Cache no longer requires initialization. --- modules/civitai/download_civitai.py | 2 +- modules/hashes.py | 6 +++--- webui.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/civitai/download_civitai.py b/modules/civitai/download_civitai.py index f04012c90..154b93448 100644 --- a/modules/civitai/download_civitai.py +++ b/modules/civitai/download_civitai.py @@ -286,7 +286,7 @@ class DownloadManager: name = os.path.splitext(item.filename)[0] title = f"{prefix}/{name}" hashes.cache().add_hash(title, os.path.getmtime(final_file), item.expected_hash.lower()) - hashes.dump_cache() + hashes.save_cache() except Exception: pass diff --git a/modules/hashes.py b/modules/hashes.py index 26e177719..02feeffa5 100644 --- a/modules/hashes.py +++ b/modules/hashes.py @@ -28,13 +28,13 @@ _data: defaultdict[str, HashStore] = defaultdict(HashStore) progress_ok = True -def init_cache(): +def load_cache(): if os.path.isfile(cache_filename): for store, data in readfile(cache_filename, lock=True, as_type="dict").items(): _data[store] = HashStore(data) -def dump_cache(): +def save_cache(): writefile(_data, cache_filename) @@ -104,7 +104,7 @@ def sha256(filename: str, title: str, use_addnet_hash=False): sha256_value = calculate_sha256(filename) hashes.add_hash(title, os.path.getmtime(filename), sha256_value) shared.state.end(jobid) - dump_cache() + save_cache() return sha256_value diff --git a/webui.py b/webui.py index 11c48e8a5..b8d06697f 100644 --- a/webui.py +++ b/webui.py @@ -77,7 +77,7 @@ def initialize(): from concurrent.futures import ThreadPoolExecutor, as_completed modules.sd_checkpoint.init_metadata() - modules.hashes.init_cache() + modules.hashes.load_cache() modules.sd_samplers.list_samplers() timer.startup.record("samplers")