From c4827360ea9fd77106654af583f4d12b1d28a7db Mon Sep 17 00:00:00 2001 From: erichuyuehu Date: Mon, 21 Aug 2023 10:58:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E4=BF=AE=E6=94=B9=E8=BF=9B=E5=85=A5?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E6=B8=85=E9=99=A4=E7=BC=93=E5=AD=98=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MSDKDns/CacheManager/MSDKDnsNetworkManager.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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]; }];