This commit is contained in:
doms9 2025-10-15 10:53:54 -04:00
parent b110aee1e8
commit 00000d9ba6
11 changed files with 121 additions and 135 deletions

View file

@ -11,7 +11,7 @@ class Cache:
self.now_ts = Time.now().timestamp()
def is_fresh(self, entry: dict) -> bool:
ts: float | int = entry.get("timestamp", 31496400)
ts: float | int = entry.get("timestamp", Time.default_8())
dt_ts = Time.clean(Time.from_ts(ts)).timestamp()
@ -20,7 +20,7 @@ class Cache:
def load(
self,
per_entry: bool = True,
index: bool = False,
index: int | None = None,
) -> dict[str, dict[str, str | float]]:
try:
@ -32,10 +32,10 @@ class Cache:
return {k: v for k, v in data.items() if self.is_fresh(v)}
if index:
ts: float | int = data[0].get("timestamp", 31496400)
ts: float | int = data[index].get("timestamp", Time.default_8())
else:
ts: float | int = data.get("timestamp", 31496400)
ts: float | int = data.get("timestamp", Time.default_8())
dt_ts = Time.clean(Time.from_ts(ts)).timestamp()