diff --git a/MSDKDns/CacheManager/MSDKDnsNetworkManager.m b/MSDKDns/CacheManager/MSDKDnsNetworkManager.m index 027697f..92532c7 100644 --- a/MSDKDns/CacheManager/MSDKDnsNetworkManager.m +++ b/MSDKDns/CacheManager/MSDKDnsNetworkManager.m @@ -95,11 +95,13 @@ - (instancetype)init usingBlock:^(NSNotification *note) { BOOL expiredIPEnabled = [[MSDKDnsParamsManager shareInstance] msdkDnsGetExpiredIPEnabled]; - if (!expiredIPEnabled) { + BOOL persistCacheIPEnabled = [[MSDKDnsParamsManager shareInstance] msdkDnsGetPersistCacheIPEnabled]; + if (!expiredIPEnabled && !persistCacheIPEnabled) { MSDKDNSLOG(@"Application did enter background,clear MSDKDns cache"); - //进入后台时清除缓存,暂停网络监测 + //进入后台时清除缓存,排除开启了持久化缓存或者开启了使用过期缓存IP的情况 [[MSDKDnsManager shareInstance] clearAllCache]; } + //进入后台时,暂停网络监测 [self.reachability stopNotifier]; }];