def write_records_to_cache(records: List, key: Union[str, int], value: Union[str, int], cache_dir: Path):
with Cache(directory=str(cache_dir), size_limit=CACHE_MAX_SIZE) as cache_ref:
for rec in records:
write_record_to_cache(rec[key], rec[value], cache_dir)
Do not call write_record_to_cache whithin write_records_to_cache as this creates a new reference to the cache each time. Instead, directly write to cache with the given reference.
Do not call
write_record_to_cachewhithinwrite_records_to_cacheas this creates a new reference to the cache each time. Instead, directly write to cache with the given reference.