+##### Cache #####
+
+def is_cache_initialized(key: str) -> bool:
+ return key in cache
+
+def set_all_cache_key(key: str, rows: list, value: any):
+ # DEBUG: print(f"DEBUG: key='{key}',rows()={len(rows)},value[]={type(value)} - CALLED!")
+ if not is_cache_initialized(key):
+ # DEBUG: print(f"DEBUG: Cache for key='{key}' not initialized.")
+ cache[key] = {}
+
+ for sub in rows:
+ # DEBUG: print(f"DEBUG: Setting key='{key}',sub[{type(sub)}]='{sub}'")
+
+ if isinstance(sub, tuple):
+ cache[key][sub[0]] = value
+ else:
+ print(f"WARNING: Unsupported type row[]='{type(row)}'")
+
+ # DEBUG: print("DEBUG: EXIT!")
+
+def set_cache_key(key: str, sub: str, value: any):
+ if not is_cache_initialized(key):
+ print(f"WARNING: Bad method call, key='{key}' is not initialized yet.")
+ raise Exception(f"Cache for key='{key}' is not initialized, but function called")
+
+ cache[key][sub] = value
+
+def is_cache_key_set(key: str, sub: str) -> bool:
+ if not is_cache_initialized(key):
+ print(f"WARNING: Bad method call, key='{key}' is not initialized yet.")
+ raise Exception(f"Cache for key='{key}' is not initialized, but function called")
+
+ return sub in cache[key]
+