Skip to content

Commit

Permalink
feat:修改进入后台清除缓存逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
erichuyuehu committed Aug 21, 2023
1 parent 51b6874 commit c482736
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MSDKDns/CacheManager/MSDKDnsNetworkManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}];

Expand Down

0 comments on commit c482736

Please sign in to comment.