diff options
| author | Bobby <[email protected]> | 2024-09-04 00:55:20 -0400 |
|---|---|---|
| committer | Bobby <[email protected]> | 2024-09-04 00:55:20 -0400 |
| commit | b73b047452ba47141a96cf000333fc9a7211aa91 (patch) | |
| tree | c1a306d9afb5f6ecf260f56d64280847588878db /detail | |
| parent | 763308caf9442b9b636a14ae0fb4b0659e2a0c8c (diff) | |
| download | yugen-b73b047452ba47141a96cf000333fc9a7211aa91.tar.xz yugen-b73b047452ba47141a96cf000333fc9a7211aa91.zip | |
small fixes
Diffstat (limited to 'detail')
| -rw-r--r-- | detail/views.py | 5 |
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 |
