hurshi / dio-http-cache

http cache lib for Flutter dio like RxCache
Apache License 2.0
274 stars 223 forks source link

How to fetch from cache if available but still load from network in background #58

Open damms005 opened 4 years ago

damms005 commented 4 years ago

Thanks for this awesome package.

Please I have a scenario whereby I want my app to be very responsive. At same time, I want it to have updated content. So, I am trying to implement this requirement:

  1. If resources does not exist in cache, load from internet and save to cache
  2. If resource exists in cache, immediately return cached content but refresh cache in the background.

However, I am open to other alternatives to this design as long as it achieves the aim

hurshi commented 3 years ago

Thanks for your advice, that's a good idea. I'll think about it later

allanwolski commented 3 years ago

Great job @hurshi I need this too.

danielweil commented 3 years ago

Great idea, if there is a way you to handle this it would be very usefull

dodatw commented 3 years ago

I need this function too. Is there any way that we can do it base on current code? ex, check cache exist by key? if cache exist, return it and fire another request at background.

xVemu commented 2 years ago

Any news?