hurshi / dio-http-cache

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

Add expiry date option #68

Closed deadsoul44 closed 3 years ago

deadsoul44 commented 3 years ago

Thank you for the great package. Some data on server is updated with changing frequency. When making an api call, the expiry date is sometimes known. When a fixed refresh duration is set, it is possible to get outdated data from cache. Refresh duration can be set to the lowest possible but this will result in unnecessary api calls when data is updated on the server with less frequency. So, an optional expiry date parameter could be very useful.

hurshi commented 3 years ago

Hello, thanks for your feedback It's not supported to modify the expiry date directly, but get maxAge from Cache-Control was supported.

maxAge: set the cache time. If the value is null or not setted, it will try to get maxAge and maxStale from response headers.