thesadru / genshinstats

PLEASE USE GENSHIN.PY A python library that can get the stats of Genshin Impact players using Mihoyo's API. PLEASE USE GENSHIN.PY
https://thesadru.github.io/pdoc/genshinstats/
MIT License
268 stars 38 forks source link

Asking about permanent_cache #25

Closed rushkii closed 3 years ago

rushkii commented 3 years ago

Hello, sorry to open the issue just to ask a function. My question is:

  1. How permanent_cache() works?
  2. Is it to cache JSON data from API response?
  3. Is it possible to permanent cache of the get_user_stats() response?
  4. If it's not possible to permanent cache of the get_user_stats() response, should I use MongoDB to cache it?

Thank you.

thesadru commented 3 years ago

permanent_cache() is an internal decorator I added to not have to request the list of languages and similar static resources multiple times. It simply stores the return of the function in a dictionary. The cache is meant to be more of a utility decorator rather than something meant for serious storing of data. Sure you can use it to cache json responses but it's not optimized to do so.

Personally, I use cachetools to cache the results when I need to.

rushkii commented 3 years ago

Well got it, thanks for the answer and sharing the cachetools library.