pegos-data / app /core /cache.py
Caner7's picture
Update app/core/cache.py
ec93d35 verified
Raw
History Blame Contribute Delete
525 Bytes
# =====================================================
# app/core/cache.py
# RAM tabanlı basit cache yönetimi
# =====================================================
import time
from app.core.config import settings
_cache = {"data": None, "timestamp": 0}
def get_cache():
if not _cache["data"]:
return None
if time.time() - _cache["timestamp"] < settings.CACHE_TTL:
return _cache["data"]
return None
def set_cache(data: dict):
_cache["data"] = data
_cache["timestamp"] = time.time()