美文网首页
SDWebimage

SDWebimage

作者: liboxiang | 来源:发表于2018-12-03 10:44 被阅读8次
  • NSCache、NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)
  • NSOperationQueue,控制最大同时下载数
  • 网络请求只有一个session
  • 缓存管理:
    在删除disk缓存的时候回循环判断是否缓存size已经小于设置的最大缓存值,如果不符合条件则根据创建日期删除最旧文件,直到符合条件
[[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(clearMemory)
                                                     name:UIApplicationDidReceiveMemoryWarningNotification
                                                   object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(deleteOldFiles)
                                                     name:UIApplicationWillTerminateNotification
                                                   object:nil];

        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(backgroundDeleteOldFiles)
                                                     name:UIApplicationDidEnterBackgroundNotification
                                                   object:nil];

相关文章

网友评论

      本文标题:SDWebimage

      本文链接:https://www.haomeiwen.com/subject/pfnecqtx.html