Skip to content

Commit

Permalink
Update ai_modules.py
Browse files Browse the repository at this point in the history
TTL 적용. 1시간이 지나면 캐시를 강제로 갱신시켜 파인콘의 최신 정보를 가져올 수 있도록 수정.
  • Loading branch information
Seokhyuneee authored Dec 5, 2024
1 parent aedcc14 commit d9b1c69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ai_server_code/ai_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,9 @@ def initialize_cache():
cached_titles, cached_texts, cached_urls, cached_dates = fetch_titles_from_pinecone()

# 데이터를 Redis에 저장 (직렬화)
redis_client.set('pinecone_metadata', pickle.dumps((cached_titles, cached_texts, cached_urls, cached_dates)))
# redis_client.set('pinecone_metadata', pickle.dumps((cached_titles, cached_texts, cached_urls, cached_dates)))
redis_client.setex('pinecone_metadata', 3600, pickle.dumps((cached_titles, cached_texts, cached_urls, cached_dates))) # TTL 설정


################################# 24.11.16기준 정확도 측정완료 #####################################################
######################################################################################################################
Expand Down

0 comments on commit d9b1c69

Please sign in to comment.