Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API 호출별 로컬 캐싱 구현 #11

Closed
3 tasks done
salmontaker opened this issue Sep 7, 2023 · 0 comments · Fixed by #12
Closed
3 tasks done

API 호출별 로컬 캐싱 구현 #11

salmontaker opened this issue Sep 7, 2023 · 0 comments · Fixed by #12
Assignees
Labels
feat 기능관련

Comments

@salmontaker
Copy link
Contributor

salmontaker commented Sep 7, 2023

Todo

  • useSuggestion훅 내부에서 사용할 수 있는 캐시기능 추가
  • Expire Time 구현
  • useSuggestion훅과 연동
@salmontaker salmontaker added the feat 기능관련 label Sep 7, 2023
@salmontaker salmontaker self-assigned this Sep 7, 2023
@salmontaker salmontaker linked a pull request Sep 7, 2023 that will close this issue
salmontaker added a commit that referenced this issue Sep 7, 2023
## Description

로컬 캐시기능을 구현하였습니다.

## Changes

- private class field 사용을 위해 compilerOptions의 target을 es6로 변경하였습니다.
- 메모리에 API의 결과값을 저장할 수 있는 `CacheRepository`를 구현하였습니다.
- 다양한 타입에 대응할 수 있도록 제네릭으로 구현하였습니다.
- useSuggestions 커스텀 훅에 캐시기능을 연동하였습니다.
- 해당 검색어에 대한 캐시가 존재하고, expireTime이 지나지 않았으면 캐시에 저장된 값으로 suggestions의 상태를
업데이트합니다.
- 해당 검색어에 대한 캐시가 존재하지 않거나, expireTime이 지났으면, API 응답 값으로 suggestions의 상태를
업데이트하고 캐시에 결과값을 저장합니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat 기능관련
1 participant