陈斌彬的技术博客

Stay foolish,stay hungry

SDImageCache中提供获取当前缓存大小和清除缓存的的方法

SDWebImage中的SDImageCache

获取当前缓存大小:

//字节大小
int byteSize = (int)[SDImageCache sharedImageCache].getSize;
//M大小
CGFloat cacheSize = byteSize / 1000.0 / 1000.0;
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"清理缓存" message:[NSString stringWithFormat:@"缓存大小%.1fM",cacheSize] delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
[alert show];

清除缓存:

//清除缓存
[[SDImageCache sharedImageCache] clearDisk];