adding caching to presque gratos
This commit is contained in:
20
keys.py
Normal file
20
keys.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# keys.py (or inline in your main)
|
||||
def xgp_key(item) -> str:
|
||||
# Prefer stable Microsoft Store productId if present; fallback to normalized title.
|
||||
pid = (item.get("productId") or "").strip()
|
||||
if pid:
|
||||
return f"item:xgp:{pid}"
|
||||
title = (item.get("title") or "").strip().lower()
|
||||
return f"item:xgp:title:{title}"
|
||||
|
||||
def egs_key(item) -> str:
|
||||
# Use title + start window (your fetcher usually knows the free-week start)
|
||||
title = (item.get("title") or "").strip()
|
||||
start = (item.get("start") or "").strip() # ISO or YYYY-MM-DD
|
||||
return f"item:egs:{title}|{start}"
|
||||
|
||||
def psplus_key(item) -> str:
|
||||
# Use official PS Blog URL + the published month (or your computed date)
|
||||
url = (item.get("url") or "").strip()
|
||||
date = (item.get("date") or "").strip()
|
||||
return f"item:psplus:{url}|{date}"
|
||||
Reference in New Issue
Block a user