Minor function renaming

Cache no longer requires initialization.
This commit is contained in:
awsr
2026-04-11 13:14:46 -07:00
parent e4aaed9eee
commit 1647be96de
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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
+3 -3
View File
@@ -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
+1 -1
View File
@@ -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")