ブックマーク / zenn.dev/tokutsu (1)

  • 【React Query】情報屋の例えでcacheTime, staleTimeを理解する

    最近React Queryがv4になりました。 オプションのcacheTime, staleTimeについて何回ググっても忘れてしまうため、 例え話で理解してみようと思います。 公式ドキュメント cacheTime The time in milliseconds that unused/inactive cache data remains in memory. When a query's cache becomes unused or inactive, that cache data will be garbage collected after this duration. When different cache times are specified, the longest one will be used. 未使用/非活動状態のキャッシュデータがメモリ内に残る時間(ミリ秒

    【React Query】情報屋の例えでcacheTime, staleTimeを理解する
    carolina04
    carolina04 2022/08/27
    “staleTimeの経過前にデータを求められた場合は、 APIのリクエストを行わずにキャッシュのデータを即座に返す。”
  • 1