INNER CODE UNIT · Python
get_cached_github_profile
sunithvs/devb.io · api/main.py:56
async def get_cached_github_profile(username: str) -> Dict[str, Any]:
"""Fetch and cache GitHub profile data"""
cache_key = f"github_profile_basic:{username}"
if Settings.CACHE_ENABLED:
cached_response = await redis_client.get(cache_key)
if cached_response:
return json.loads(cached_response)
basic_profile = GitHubProfileFetcher.fetch_user_profile(username)
basic_profile['cached'] = False
try:
ai_generator = AIDescriptionGenerator()
about_data = ai_generator.generate_profile_summary(basic_profile)
seo_data = ai_generator.generate_seo_contents(basic_profile)
basic_profile['about'] = about_data
basic_profile['seo'] = seo_data