Skip to content

Commit

Permalink
setex
Browse files Browse the repository at this point in the history
  • Loading branch information
wabinyai committed Mar 8, 2025
1 parent a66eaf7 commit 6ab8b04
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/spatial/models/chatbot_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def fetch_air_quality_data(grid_id, start_time, end_time):
response = requests.post(url, json=payload, timeout=5)
response.raise_for_status()
data = response.json()
# Cache response in Redis for 1 hour
# setex is
# Cache response in Redis for 1 hour
# setex is redis command to set a key with an expiration time
with data_fetch_lock:
if redis_client:
redis_client.setex(cache_key, 3600, json.dumps(data))
Expand Down

0 comments on commit 6ab8b04

Please sign in to comment.