aboutsummaryrefslogtreecommitdiff
path: root/detail
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-09-04 00:55:20 -0400
committerBobby <[email protected]>2024-09-04 00:55:20 -0400
commitb73b047452ba47141a96cf000333fc9a7211aa91 (patch)
treec1a306d9afb5f6ecf260f56d64280847588878db /detail
parent763308caf9442b9b636a14ae0fb4b0659e2a0c8c (diff)
downloadyugen-b73b047452ba47141a96cf000333fc9a7211aa91.tar.xz
yugen-b73b047452ba47141a96cf000333fc9a7211aa91.zip
small fixes
Diffstat (limited to 'detail')
-rw-r--r--detail/views.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/detail/views.py b/detail/views.py
index 4b247e6..a3495ad 100644
--- a/detail/views.py
+++ b/detail/views.py
@@ -33,7 +33,10 @@ def get_anime_data(anime_id):
response = requests.get(base_url, timeout=10)
response.raise_for_status()
anime_data = response.json()
- store_in_redis_cache(cache_key, json.dumps(anime_data), 86400) # Cache for 24 hours
+ if anime_data["status"] == "Completed":
+ store_in_redis_cache(cache_key, json.dumps(anime_data), 3600 * 24 * 30) # Cache for 30 days
+ else:
+ store_in_redis_cache(cache_key, json.dumps(anime_data), 3600 * 12) # Cache for 12 hours
except requests.RequestException as e:
print(f"Error fetching anime data for ID {anime_id}: {e}")
return None