SDWebImage、WebView产生的缓存
1、计算缓存大小
//SDWebImage缓存大小
UILabel *cleanDetailText = [[UILabel alloc]init];
unsigned long iLength = [[SDImageCache sharedImageCache]getSize]/1024.0;
if(iLength > 1024.0)
{
iLength = iLength/1024.0;
NSString *sLength = [NSString stringWithFormat:@"%lu",iLength];
cleanDetailText.text = [sLength stringByAppendingString:@"M"];
}
else
{
NSString *sLength = [NSString stringWithFormat:@"%lu",iLength];
cleanDetailText.text = [sLength stringByAppendingString:@"kb"];
}
//WebView缓存大小
NSInteger sizeInteger = [[NSURLCache sharedURLCache] currentDiskUsage];
float sizeInMB = sizeInteger / (1024.0f * 1024.0f);
2、清理缓存
//SDWebImage清理缓存
[[[SDWebImageManager sharedManager]imageCache]clearDisk];
[[[SDWebImageManager sharedManager]imageCache]clearMemory];
//WebView清理缓存
[[NSURLCache sharedURLCache]removeAllCachedResponses];