ByteCast #6 - Caching Network Request | Swift Actor & Task | NSCache

Поделиться
HTML-код
  • Опубликовано: 9 фев 2025
  • In this video, we’re going to implement a caching for network request. This is very suitable If your app doesn’t need to display data that changes frequently such as news, recent stock prices, transaction histories, etc.
    GitHub Project Repo:
    github.com/alf...
    ByteCast #5 - Generic Cache + Expiration Timestamp | NSCache | Swift:
    • ByteCast #5 - Generic ...
    ByteCast #4 - SwiftUI Task Modifier Lifecycle Handling:
    • ByteCast #4 - SwiftUI ...
    XCache SPM Lib (Generic & Network Cache)
    github.com/alf...

Комментарии • 3

  • @hamza-chaoukii
    @hamza-chaoukii 2 месяца назад

    Great example, Alfian! I have a question about caching network requests: While caching is an excellent solution to prevent redundant API calls, how would we handle scenarios where the data in the API changes? If there’s new data to fetch, wouldn’t we need a way to listen for updates or changes to ensure the cache stays in sync? Looking forward to your thoughts!

    • @XCA
      @XCA  2 месяца назад

      One thing you can do is to use silent remote push notification. Your backend can send a signal telling the app to invalidate the local cache.

    • @hamza-chaoukii
      @hamza-chaoukii 2 месяца назад

      @@XCA Thank you for the suggestion! I will definitely try this out.