Closed slavap closed 4 years ago
Example:
rest.interceptors.add( DioCacheManager( CacheConfig( baseUrl: rest.options.baseUrl, defaultMaxAge: Duration(minutes: 5), ), ).interceptor, );
defaultMaxAge is NOT used in case server does not return any max-age in response. The bug is probably in:
Future<bool> _pushToCache(Response response) { RequestOptions options = response.request; Duration maxAge = options.extra[DIO_CACHE_KEY_MAX_AGE]; Duration maxStale = options.extra[DIO_CACHE_KEY_MAX_STALE]; if (null == maxAge) { _tryParseHead(response, maxStale, (_maxAge, _maxStale) { maxAge = _maxAge; maxStale = _maxStale; }); } // FIX if (null == maxAge) { maxAge = _manager?._config.defaultMaxAge; maxStale = _manager?._config.defaultMaxStale; } // End of FIX if (null == maxAge) return Future.value(false);
See also comments in https://github.com/hurshi/dio-http-cache/issues/12
Hello, thanks for your feedback. Yes, it's a bug. and it has fixed in new version: 0.2.6
Example:
defaultMaxAge is NOT used in case server does not return any max-age in response. The bug is probably in:
See also comments in https://github.com/hurshi/dio-http-cache/issues/12