Spaces:
Sleeping
Sleeping
Download utils/cache.py from Atharva31/Finance_AgenticRAG: direct link, hf CLI and curl.
- Browser
- Download file 322 Bytes
-
https://huggingface.co/spaces/Atharva31/Finance_AgenticRAG/resolve/main/utils/cache.py
- Command line
-
hf download hf://spaces/Atharva31/Finance_AgenticRAG/utils/cache.py
-
curl -L -o cache.py https://huggingface.co/spaces/Atharva31/Finance_AgenticRAG/resolve/main/utils/cache.py
322 Bytes
| import time | |
| _cache = {} | |
| def get_cache(key): | |
| value = _cache.get(key) | |
| if not value: | |
| return None | |
| data, expiry = value | |
| if time.time() > expiry: | |
| _cache.pop(key, None) | |
| return None | |
| return data | |
| def set_cache(key, value, ttl: int): | |
| _cache[key] = (value, time.time() + ttl) |